I'am litte bit confused about the the functinning of the spaceship operator on string. In the documentation they say that comparisons are performed according to PHP's usual type comparison rules but not yet clear to me! I looked at this stackoverflow question and did some tests but still confused.
Here is the code I tested:
<?php
$str1 = "aaa";
$str2 = "aaaa";
echo $str1 <=> $str2, PHP_EOL; // -1
$str1 = "baaaaaa";
$str2 = "abbb";
echo $str1 <=> $str2, PHP_EOL; // 1
$str1 = "aaaaaaa";
$str2 = "bbbb";
echo $str1 <=> $str2, PHP_EOL; // -1
How it uses the ASCII values? Thank you for help.