unexpected $varable value

Hi Guys,

Actually, this program has 2 for loop(for $i and for $j), the purpose is compare 2 array ‘prefix’ value,
and then rebuild a new array $updatecountryfileroute[] and save.

Please see below “if else” expression;

if ([$j][‘prefix’]===[$i][‘prefix’])
{
$route=[$j][‘changecarrier’]
}
else
$route=$[$i][‘route’]

I supposed the $route default value contains [$i][‘route’], because [$j][‘prefix’]!==[$i][‘prefix’]

but if [$j][‘prefix’]===[$i][‘prefix’], the $route value should change to [$j][‘changecarrier’],
now the problem is $route always contain $[$i][‘route’], it seem doesn’t accept [$j][‘changecarrier’] value ?

Original codes as below

[php]for ($i=0;$i<$countcountryfile;$i++)
{

 for ($j=0;$j<$countupdateroute;$j++)
	 {
		 
			
		if ($updateroute[$j]['prefix']===$countryFileroute[$i]['prefix'])
                {
		$route=$updateroute[$j]['changecarrier'];
	        }
		    
		    else
		{
		$route=$countryFileroute[$i]['route'];
	        }
		
	 } //end j loop

$updatecountryfileroute[]=array(‘route’=>$route);

$route="";

} //end i loop[/php]

Thank you all

Brgds/Brandon Chau

Hi all guys,

I have resolved the problem already , thank you all ^^"

Brgds/Brandon Chau

Sponsor our Newsletter | Privacy Policy | Terms of Service