You get a bonus - 1 coin for daily activity. Now you have 1 coin

PHP spaceship operator less space equals more

Lecture



This operator is designed to compare two expressions. It returns -1, 0, or 1 if $ a, respectively, is less than, equal to, or greater than $ b. The comparison is made in accordance with the rules of comparing PHP types.

<? php
// Integers
echo 1 <=> 1; // 0
echo 1 <=> 2; // -one
echo 2 <=> 1; // one

// Rational
echo 1.5 <=> 1.5; // 0
echo 1.5 <=> 2.5; // -one
echo 2.5 <=> 1.5; // one

// Strings
echo "a" <=> "a"; // 0
echo "a" <=> "b"; // -one
echo "b" <=> "a"; // one
?>


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Running server side scripts using PHP as an example (LAMP)

Terms: Running server side scripts using PHP as an example (LAMP)