<?php
$employees = array(
1 => array(
'name' => 'Jason Alipala',
'employee_id' => 'G1001-05',
'position' => 1
),
2 => array(
'name' => 'Bryann Revina',
'employee_id' => 'G1009-03',
'position' => 2
),
3 => array(
'name' => 'Jeniel Mangahis',
'employee_id' => 'G1009-04',
'position' => 2
),
4 => array(
'name' => 'Arjay Bussala',
'employee_id' => 'G1009-05',
'position' => 3
),
5 => array(
'name' => 'Ronnel Ines',
'employee_id' => 'G1002-06',
'position' => 3
)
);
print_r(array_count_values(array_map(function($v){return $v['position'];}$employees)));
- Output for 7.0.0 - 7.0.1
- Parse error: syntax error, unexpected '$employees' (T_VARIABLE), expecting ',' or ')' in /in/5vTNq on line 31
Process exited with code 255. - Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
- Parse error: syntax error, unexpected '$employees' (T_VARIABLE) in /in/5vTNq on line 31
Process exited with code 255.
preferences:
168.4 ms | 1395 KiB | 25 Q