PHP 7 iyo Hawlwadeenka Goobta

Marka lagu daro astaamaha cusub sida nambarka noocyada noocyada xogta qiyaasta ama waxqabadka la hagaajiyay , PHP 7 sidoo kale waxay keeneysaa luuqado badan oo cusub oo faa iido leh "Spaceship Operator" ayaa ugu dambayntii ka dhigay adduunka PHP (barnaamijyada Ruby iyo Perl ayaa yaqaanay muddo dheer). \($a <=> $b\) celinta \(0\) haddii oo keliya haddii labada operands waa u siman yihiin, \(1\) haddii mid ka mid bidix waa weyn oo \(-1\) haddii kale.


Iyadoo la raacayo, hawl wadeenkan cusub wuxuu u dhigmaa shaqada calaamadda \(sgn(xy)\) laga yaqaan xisaabta. Tani waxay ka dhigan tahay in hawl wadeenada isbarbar dhiga jira sidoo kale loo turjumi karo iyadoo la adeegsanayo qaabeynta cusub:

\($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\)

The Xeerar la mid ah sida kuwa ka shaqeeysta isbarbardhigga ( \([1,2,3] <=>[1,2,1]\) uyeelaysaan kuwo \(1\) ).

Dib u laabo