Php Undefined Variable - Undefined Offset Problem Solve - Learn here ~ Ofuran

Php Undefined Variable - Undefined Offset Problem Solve - Learn here

Php Undefined Variable - Undefined Offset Problem Solve - Learn here

If you use a php variable, that exists but show an unwanted error like as undefined variable or undefined offset error in the server erroe_log file and this file is gradually increasing. So a nice solve is exists for this php problem.


php undefined offset, undefined variable problem


Find which line of the php script page show that error, then you should follow the following steps.

1. Use a conditional sentence like as 'isset' in that php variable. 
Example: if(isset($variable)){$other = $variable;}

2. Alternative way to solve is to use php empty() function on that variable. 
Example: if(!empty($variable)){$other = $variable;}
or,            $other = !empty($variable); 

and so many ways to show examples. If you face more problem, please comment below. Thanks for being with ofuran.com .

'