- strcasecmp: documentation ( source)
- json_decode: documentation ( source)
- strcmp: documentation ( source)
- var_export: documentation ( source)
- usort: documentation ( source)
<?php
$data = json_decode('[{"first_name":"Rebecca"},{"first_name":"amy"},{"first_name":"Amy"},{"first_name":"stacy"}]', true);
usort(
$data,
fn($a, $b) => strcasecmp($a['first_name'], $b['first_name'])
?: strcmp($a['first_name'], $b['first_name'])
);
var_export($data);