Skip to content

Instantly share code, notes, and snippets.

<?php
//Sorting array by age
function ageSort($a, $b)
{
return ($a->age >= $b->age) ? -1 : 1;
}
$data = '{"data":[{"first_name":"jake","last_name":"bennett","age":31,"email":"[email protected]","secret":"VXNlIHRoaXMgc2VjcmV0IHBocmFzZSBzb21ld2hlcmUgaW4geW91ciBjb2RlJ3MgY29tbWVudHM="},{"first_name":"jordon","last_name":"brill","age":85,"email": "[email protected]","secret":"YWxidXF1ZXJxdWUuIHNub3JrZWwu"}]}';
//Format data to array