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

О проекте

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

MySQL

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

Хостинг

Другое








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

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

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

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

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

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

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

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

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

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

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

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



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





Руководство по PHP
Пред. След.

version_compare

(PHP 4 >= 4.1.0, PHP 5)

version_compare --  Compares two "PHP-standardized" version number strings

Description

mixed version_compare ( string version1, string version2 [, string operator] )

version_compare() compares two "PHP-standardized" version number strings. This is useful if you would like to write programs working only on some versions of PHP.

version_compare() returns -1 if the first version is lower than the second, 0 if they are equal, and +1 if the second is lower.

The function first replaces _, - and + with a dot . in the version strings and also inserts dots . before and after any non number so that for example '4.3.2RC1' becomes '4.3.2.RC.1'. Then it splits the results like if you were using explode('.', $ver). Then it compares the parts starting from left to right. If a part contains special version strings these are handled in the following order: dev < alpha = a < beta = b < RC < pl. This way not only versions with different levels like '4.1' and '4.1.2' can be compared but also any PHP specific version containing development state.

If you specify the third optional operator argument, you can test for a particular relationship. The possible operators are: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne respectively. Using this argument, the function will return TRUE if the relationship is the one specified by the operator, FALSE otherwise.

Замечание: PHP_VERSION constant holds current PHP version.

Пример 1. version_compare() example

<?php
// prints -1
echo version_compare("4.0.4", "4.0.6");

// these all print 1
echo version_compare("4.0.4", "4.0.6", "<");
echo
version_compare("4.0.6", "4.0.6", "eq");
?>



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





Copyright © 2005-2016 Project.Net.Ru