c2ec1c97c9
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.
Codemods:
codemod '([;{}])([^\n])' '\1\n\2'
codemod -m '\s*<\?php\s+' '<?php\n\n'
codemod '\t' ' '
I hand-fixed all the failing tests
21 linhas
349 B
PHP
21 linhas
349 B
PHP
<?php
|
|
|
|
function xsort(&$a) {
|
|
$b = null;
|
|
$b->foo =& $a;
|
|
var_dump(is_object($b));
|
|
$b = false;
|
|
$b[0] =& $a;
|
|
uksort($a, function ($i, $j) use(&$b) {
|
|
if ($b[0][$i] == $b[0][$j]) return 0;
|
|
return $b[0][$i] < $b[0][$j] ? -1 : 1;
|
|
}
|
|
);
|
|
}
|
|
function test($x) {
|
|
$a = array(220,250,240,$x);
|
|
xsort($a);
|
|
var_dump($a);
|
|
}
|
|
test(230);
|