CakePHP view variable scope issue -
i have these lines in view file
////////////////////////////  $a = 5; showme()  showme() {  global $a;  echo $a; }  ////////////////////////////////   problem: $a not accessible in showme() function.
i have no choice pass $a argument , no choice move function view. , should accessible in function through global keyword only.
i can change way of declaration $a.
you missing semi-colon end later statement:
$a = 5; showme()   change to:
$a = 5; showme();   your code seems ok, should work, not sure may try if inside class:
$a = 5; $this->showme();      
Comments
Post a Comment