<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://wbex.ru/index.php?action=history&amp;feed=atom&amp;title=PHP%2FOperator%2FComparison_Operators</id>
		<title>PHP/Operator/Comparison Operators - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://wbex.ru/index.php?action=history&amp;feed=atom&amp;title=PHP%2FOperator%2FComparison_Operators"/>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Operator/Comparison_Operators&amp;action=history"/>
		<updated>2026-04-05T22:54:08Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://wbex.ru/index.php?title=PHP/Operator/Comparison_Operators&amp;diff=1200&amp;oldid=prev</id>
		<title> в 10:37, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Operator/Comparison_Operators&amp;diff=1200&amp;oldid=prev"/>
				<updated>2010-05-26T10:37:28Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 10:37, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://wbex.ru/index.php?title=PHP/Operator/Comparison_Operators&amp;diff=1201&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Operator/Comparison_Operators&amp;diff=1201&amp;oldid=prev"/>
				<updated>2010-05-26T07:06:45Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Comparing numbers and strings==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?&lt;br /&gt;
// These values are compared using dictionary order&lt;br /&gt;
if (&amp;quot;x54321&amp;quot; &amp;gt; &amp;quot;x5678&amp;quot;) {&lt;br /&gt;
    print &amp;quot;The string &amp;quot;x54321&amp;quot; is greater than the string &amp;quot;x5678&amp;quot;.&amp;quot;;&lt;br /&gt;
} else {&lt;br /&gt;
    print &amp;quot;The string &amp;quot;x54321&amp;quot; is not greater than the string &amp;quot;x5678&amp;quot;.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Comparison Operators==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
example         name                               result&lt;br /&gt;
$a == $b        Equal                              True if $a is equal to $b.&lt;br /&gt;
$a === $b       Identical                          True if $a is equal to $b, and they are of the same type. (PHP4 only)&lt;br /&gt;
$a != $b        Not equal                          True if $a is not equal to $b.&lt;br /&gt;
$a &amp;lt; $b         Less than                          True if $a is strictly less than $b.&lt;br /&gt;
$a &amp;gt; $b         Greater than                       True if $a is strictly greater than $b.&lt;br /&gt;
$a &amp;lt;= $b        Less than or equal to              True if $a is less than or equal to $b.&lt;br /&gt;
$a &amp;gt;= $b        Greater than or equal to           True if $a is greater than or equal to $b.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
  $a = (&amp;quot;PHP&amp;quot;==&amp;quot;PHP&amp;quot;)? &amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $b = (&amp;quot;PHP&amp;quot;==&amp;quot;PERL&amp;quot;)?&amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $c = (1.785==1.785)? &amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $d = (5 != 5)?&amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $e = (true == true)?&amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $f = (false != false)?&amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $g = (100&amp;lt;200)?&amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $h = (100&amp;lt;100)?&amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $i = (100&amp;lt;=100)?&amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  $j = ( -1 &amp;gt; 1 )?&amp;quot;true&amp;quot;:&amp;quot;false&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  $result =  &amp;quot;TEST STRINGS \$a:$a  \$b:$b&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
  $result .= &amp;quot;TEST NUMBERS \$c:$c \$d:$d&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
  $result .= &amp;quot;TEST BOOLEANS \$e:$e \$f:$f&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
  $result .= &amp;quot;TEST LESS THAN \$g:$g \$h:$h&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
  $result .= &amp;quot;TEST LESS THAN OR EQUAL \$i:$i&amp;lt;br&amp;gt;&amp;quot;;  &lt;br /&gt;
  $result .= &amp;quot;TEST GREATER THAN \$j:$j&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
 &amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;title&amp;gt;Comparison Operators&amp;lt;/title&amp;gt;&lt;br /&gt;
 &amp;lt;/head&amp;gt;&lt;br /&gt;
 &amp;lt;body&amp;gt;&lt;br /&gt;
  &amp;lt;?php echo( $result ); ?&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Equality Operators in action==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
   &amp;lt;title&amp;gt;Equality&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
     &amp;lt;?php&lt;br /&gt;
          $a = 1;&lt;br /&gt;
          $b = &amp;quot;1&amp;quot;;&lt;br /&gt;
   &lt;br /&gt;
          print(&amp;quot;(\$a == \$b)&amp;quot; . (($a == $b) ? &amp;quot;True&amp;quot; : &amp;quot;False&amp;quot;) . &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;);&lt;br /&gt;
          print(&amp;quot;(\$a != \$b)&amp;quot; . (($a != $b) ? &amp;quot;True&amp;quot; : &amp;quot;False&amp;quot;) . &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;);&lt;br /&gt;
          print(&amp;quot;(\$a === \$b)&amp;quot; . (($a === $b) ? &amp;quot;True&amp;quot; : &amp;quot;False&amp;quot;) . &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;);&lt;br /&gt;
          print(&amp;quot;(\$a !== \$b)&amp;quot; . (($a !== $b) ? &amp;quot;True&amp;quot; : &amp;quot;False&amp;quot;) . &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;);&lt;br /&gt;
     ?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Equality Operators summary table==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
Operation        Operator          Example&lt;br /&gt;
Equality         ==                $a == $b&lt;br /&gt;
Inequality       !=                $a != $b&lt;br /&gt;
Inequality       &amp;lt;&amp;gt;                $a &amp;lt;&amp;gt; $b&lt;br /&gt;
Identity         ===               $a === $b&lt;br /&gt;
Nonidentity      !==               $a !== $b &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Loose Comparison Operators==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Example         Name                            Description &lt;br /&gt;
$a == $b        Equal to                        True if $ais equal to $b &lt;br /&gt;
$a != $b        Not equal to                    True if $ais not equal to $b &lt;br /&gt;
$a &amp;lt; $b         Less than                       True if $ais less than $b &lt;br /&gt;
$a &amp;gt; $b         Greater than                    True if $ais greater than $b &lt;br /&gt;
$a &amp;lt;= $b        Less than or equal to           True if $ais less than or equal to $b &lt;br /&gt;
$a &amp;gt;= $b        Greater than or equal to        True if $a is greater than or equal to $b &lt;br /&gt;
$a === $b       Equal to                        True if $ais equal to $b and they are of the same type&lt;br /&gt;
$a !== $b       Not equal to                    True if $ais not equal to $bor they are not of the same type&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The equality operator==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?&lt;br /&gt;
$new_messages = 10&lt;br /&gt;
if ($new_messages == 10) {&lt;br /&gt;
    print &amp;quot;You have ten new messages.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
if ($new_messages == $max_messages) {&lt;br /&gt;
    print &amp;quot;You have the maximum number of messages.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ($dinner == &amp;quot;B&amp;quot;) {&lt;br /&gt;
    print &amp;quot;B.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==These values are compared using dictionary order==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
if (&amp;quot;6 p&amp;quot; &amp;lt; &amp;quot;55 c&amp;quot;) {&lt;br /&gt;
    print &amp;quot;&amp;quot;6 p&amp;quot; is less than than the string &amp;quot;55 c&amp;quot;.&amp;quot;;&lt;br /&gt;
} else {&lt;br /&gt;
    print &amp;quot;&amp;quot;6 p&amp;quot; is not less than the string &amp;quot;55 c&amp;quot;.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==These values are compared using numeric order==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
if (&amp;quot;6 p&amp;quot; &amp;lt; 55) {&lt;br /&gt;
    print &amp;quot;&amp;quot;6 p&amp;quot; is less than the number 55.&amp;quot;;&lt;br /&gt;
} else {&lt;br /&gt;
    print &amp;quot;&amp;quot;6 p&amp;quot; is not less than the number 55.&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The Ternary Operator==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?&lt;br /&gt;
 $age = 18;&lt;br /&gt;
 $agestr = ($age &amp;lt; 16) ? &amp;quot;child&amp;quot; : &amp;quot;adult&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using Comparison Operators in if Statements==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
    $p = 14;&lt;br /&gt;
    if ($p &amp;lt; 15) {&lt;br /&gt;
        echo &amp;quot;Sorry! &amp;lt;BR&amp;gt;&amp;quot;;&lt;br /&gt;
    } else {&lt;br /&gt;
        echo &amp;quot;Congratulations&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>