I've multidimential PHP Array array
$_SESSION['alldata'][0]["thisisval1"] = 1
$_SESSION['alldata'][0]["markedval1"] = 1
$_SESSION['alldata'][0]["herechcked"] = 1
$_SESSION['alldata'][1]["thisisval1"] = 2
$_SESSION['alldata'][1]["markedval1"] = 1
$_SESSION['alldata'][1]["herechcked"] = 10
$_SESSION['alldata'][2]["thisisval1"] = 1
$_SESSION['alldata'][2]["markedval1"] = 0
$_SESSION['alldata'][2]["herechcked"] = 1
$_SESSION['alldata'][3]["thisisval1"] = 3
$_SESSION['alldata'][3]["markedval1"] = 0
$_SESSION['alldata'][3]["herechcked"] = 1
$_SESSION['alldata'][4]["thisisval1"] = 2
$_SESSION['alldata'][4]["markedval1"] = 1
$_SESSION['alldata'][4]["herechcked"] = 7
What is required is :
- Get list of distinct values of "thisisval1" in the array
- Get Count of array elements with "markedval1" = 1 with "thisisval1" = 1
Currently I'm thinking of running loop on $_SESSION['alldata'] and get values required above; Is there any SMART way to do same?
array_map()or whatever, you'd STILL be running at loop at some point, whether yourself explicity, or implicitly within whatever array function(s) you end up using.