<?php
<?php
$array = array(
array(
"location" => array("street_name" => "Derby Road"),
"info" => array("status" => "available"),
"specs" => array("bedroom_number" => "7")
),
array(
"location" => array("street_name" => "Derby Road"),
"info" => array("status" => "let"),
"specs" => array("bedroom_number" =>"5")
),
array(
"location" => array("street_name" => "Derby Road"),
"info" => array("status" => "let"),
"specs" => array("bedroom_number" =>"7")
),
array(
"location" => array("street_name" => "Derby Road"),
"info" => array("status" => "available"),
"specs" => array("bedroom_number" =>"5")
),
array(
"location" => array("street_name" => "Derby Road"),
"info" => array("status" => "available"),
"specs" => array("bedroom_number" =>"7")
)
);
function cmp($a, $b) {
if ($a["specs"]["bedroom_number"] === $b["specs"]["bedroom_number"]) {
return ($a["info"]["status"] !== "let") ? -1 : 1;
}
return ($a["specs"]["bedroom_number"] > $b["specs"]["bedroom_number"]) ? -1 : 1;
}
usort($array, "cmp");
var_dump($array);
- Output for 7.0.0
- Parse error: syntax error, unexpected '<', expecting end of file in /in/Bhmjo on line 3
Process exited with code 255. - Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
- Parse error: syntax error, unexpected '<' in /in/Bhmjo on line 3
Process exited with code 255.
preferences:
153.57 ms | 1395 KiB | 24 Q