I have code like below
<?php
if(true){
global $search;
$search = "hello";
}
elseif(true)
{
echo $search;
}
?>
I am unable to access $search value from if() block to elseif() block, is my approach is wrong? please anyone tell me any other way to access variables from one block to another, i need to write $search variable in if() block not like below
<?php
$search = "hello";// I don't want to use like this,
if()
elseif()
?>