migration expr


Expression typesPHP ManualPrevAppendix A. Migrating from PHP/FI 2.0 to PHP 3.0NextExpression types PHP/FI 2.0 used the left side of expressions to determine what type the result should be. PHP 3.0 takes both sides into account when determining result types, and this may cause 2.0 scripts to behave unexpectedly in 3.0. Consider this example: 1  2 $a[0]=5; 3 $a[1]=7; 4  5 $key = key($a); 6 while ("" != $key) { 7  echo "$keyn"; 8  next($a); 9 } 10  In PHP/FI 2.0, this would display both of $a's indices. In PHP 3.0, it wouldn't display anything. The reason is that in PHP 2.0, because the left argument's type was string, a string comparison was made, and indeed "" does not equal "0", and the loop went through. In PHP 3.0, when a string is compared with an integer, an integer comparison is made (the string is converted to an integer). This results in comparing atoi("") which is 0, and variablelist which is also 0, and since 0==0, the loop doesn't go through even once. The fix for this is simple. Replace the while statement with: 1  2 while ((string)$key != "") { 3 PrevHomeNextwhile syntaxUpError messages have changed

Wyszukiwarka

Podobne podstrony:
migration expr
migration expr
migration4 parser
migration booleval
2006 regulatory mechanism of gene expr ABP
migration startendtags
migration if endif
migration4 missing
migration
migration4 extensions
migration4
migrating globus
migration4 extensions
migration while

więcej podobnych podstron