I-PHP 7 kunye noMsebenzi weSpacehip

Ukongeza kwiimpawu ezintsha ezinje ngohlobo lokuthintela iintlobo zeedatha zesikali okanye ukusebenza okuphuculweyo , i-PHP 7 ikwazisa ulwandiso olutsha olunoluncedo. "Umsebenzi weSpacehip" ekugqibeleni uye wayenza kwilizwe le-PHP (Inkqubo kaRuby kunye nePerl beyazi ixesha elide). \($a <=> $b\) ubuya \(0\) ukuba kwaye kuphela ukuba zombini ii-opharetha ziyalingana, \(1\) ukuba ekhohlo inkulu kwaye \(-1\) ngenye indlela.


Ngokuhambelana, lo mqhubi mtsha uhambelana nomsebenzi wophawu \(sgn(xy)\) owaziwa kwimathematics. Oku kuthetha ukuba abaqhubi bokuthelekisa abakhoyo banokutolika besebenzisa is syntax esitsha:

\($a < $b\) \(($a <=> $b) === -1\)
\($a <= $b\) \(($a <=> $b)\) !\(== 1\)
\($a == $b\) \(($a <=> $b) === 0\)
\($a\) !\(= $b\) \(($a <=> $b)\) !\(== 0\)
\($a >= $b\) \(($a <=> $b)\) !\(== -1\)
\($a > $b\) \(($a <=> $b) === 1\)

Imigaqo efanayo iyasebenza njengabaqhubi bokuthelekisa (umzekelo \([1,2,3] <=>[1,2,1]\) ilingana \(1\) ).

Emva