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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…