Exercise: Writing an AUTOLOAD Function
Implement the incrementer and decrementer functions with the AUTOLOAD() function.
We'll cover the following
Problem statement
In this challenge, make an AUTOLOAD()
function, the details of which are given below:
Assume that the $count = 0
variable is predefined:
If an undefined function named
increment
is called with parametern
,$count
should be incremented byn
.If an undefined function named
decrement
is called with parametern
,$count
should be decremented byn
.If any other undefined function is called, the value of
$count
should remain the same.At the very end of the function, print the value of
$count
like this:
Get hands-on with 1400+ tech skills courses.