My code:
function sortx($a, $b) {
if(!strpos($a["p_title"],'apple ipad')) {
return -1;
}
return 1;
}
usort($arr, 'sortx');`
In above function I want to pass:
$sort_text='apple ipad';
, when calling function instead of hardcoding apple ipad
into strpos()
. How can I accomplish that?