My code require 2 function and each one of them need $id value. The point is how i can specific equals the $id to the value needed in each function that after the function work it will be equals to default number as i set in the top of the page. i work hard for this and searched a lot and not seen a answer. thanks guys i tried:
$id = 1;
function test1($id=2){echo $id."response 2";}
function test2($id){echo $id."response 2 but should be response 1";}
how can i do it?
Try to do the check inside the function based on the $id parameter.
function some($id){
switch($id){
case 1: doSomething();
break;
case 2: doSomethingElse();
break;
}
}