PHP Compiler Testing
Basic Calculator

Create a function that takes two numbers and a mathematical operator + - / * and will perform a calculation with the given numbers.

Examples

calculator(2, "+", 2) 4

 

calculator(2, "*", 2) 4

 

calculator(4, "/", 2) 2