П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 6106 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 8254 раз(а).

Учебник HTML.
Просмотров 4881 раз(а).

Руководство по PHP5.
Просмотров 1968 раз(а).

Хостинг через призму DNS.
Просмотров 6975 раз(а).

Подборка текстов стандартных документов.
Просмотров 57525 раз(а).

Учебник PHP - Самоучитель
Просмотров 5172 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 11299 раз(а).

Внешние атаки...
Просмотров 7253 раз(а).

Учебник PHP.
Просмотров 4261 раз(а).

SSI в примерах.
Просмотров 1203 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. Приложение D. Migrating from PHP/FI 2 to PHP 3 След.

Expression 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:

$a[0]=5;
$a[1]=7;

$key = key($a);
while ("" != $key) {
    echo "$keyn";
    next($a);
}

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:

while ((string)$key != "") {


Пред. Начало След.
while syntax Уровень выше Error messages have changed


Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru