I have an array like the code bellow:
Array ( [Row] => Array ( [0] => Array ( [PIN] => 269 [DateTime] => 2019-04-03 00:00:10 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [1] => Array ( [PIN] => 56 [DateTime] => 2019-04-03 00:00:33 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [2] => Array ( [PIN] => 99 [DateTime] => 2019-04-03 00:00:46 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [3] => Array ( [PIN] => 99 [DateTime] => 2019-04-03 00:00:49 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [4] => Array ( [PIN] => 213 [DateTime] => 2019-04-03 00:01:02 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [5] => Array ( [PIN] => 193 [DateTime] => 2019-04-03 00:01:06 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [6] => Array ( [PIN] => 271 [DateTime] => 2019-04-03 00:04:43 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [7] => Array ( [PIN] => 271 [DateTime] => 2019-04-03 00:04:52 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [8] => Array ( [PIN] => 54 [DateTime] => 2019-04-03 00:04:56 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [9] => Array ( [PIN] => 247 [DateTime] => 2019-04-03 00:07:22 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [10] => Array ( [PIN] => 225 [DateTime] => 2019-04-03 00:17:07 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [11] => Array ( [PIN] => 375 [DateTime] => 2019-04-03 00:48:06 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [12] => Array ( [PIN] => 273 [DateTime] => 2019-04-03 01:03:47 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [13] => Array ( [PIN] => 273 [DateTime] => 2019-04-03 01:03:50 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [14] => Array ( [PIN] => 282 [DateTime] => 2019-04-03 01:15:52 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [15] => Array ( [PIN] => 362 [DateTime] => 2019-04-03 01:26:02 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [16] => Array ( [PIN] => 196 [DateTime] => 2019-04-03 01:26:06 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [17] => Array ( [PIN] => 52 [DateTime] => 2019-04-03 01:26:46 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [18] => Array ( [PIN] => 32 [DateTime] => 2019-04-03 01:26:59 [Verified] => 0 [Status] => 0 [WorkCode] => 0 ) [19] => Array ( [PIN] => 362 [DateTime] => 2019-04-03 01:27:10 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [20] => Array ( [PIN] => 32 [DateTime] => 2019-04-03 01:27:20 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [21] => Array ( [PIN] => 52 [DateTime] => 2019-04-03 01:27:24 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [22] => Array ( [PIN] => 176 [DateTime] => 2019-04-03 03:00:40 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [23] => Array ( [PIN] => 176 [DateTime] => 2019-04-03 03:00:44 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [24] => Array ( [PIN] => 182 [DateTime] => 2019-04-03 03:01:02 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [25] => Array ( [PIN] => 226 [DateTime] => 2019-04-03 03:01:41 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [26] => Array ( [PIN] => 226 [DateTime] => 2019-04-03 03:01:45 [Verified] => 0 [Status] => 1 [WorkCode] => 0 ) [27] => Array ( [PIN] => 175 [DateTime] => 2019-04-03 06:39:54 [Verified] => 0 [Status] => 0 [WorkCode] => 0 ) [28] => Array ( [PIN] => 313 [DateTime] => 2019-04-03 06:41:36 [Verified] => 0 [Status] => 0 [WorkCode] => 0 ) [29] => Array ( [PIN] => 206 [DateTime] => 2019-04-03 06:43:44 [Verified] => 0 [Status] => 0 [WorkCode] => 0 ) [30] => Array ( [PIN] => 305 [DateTime] => 2019-04-03 06:55:23 [Verified] => 0 [Status] => 0 [WorkCode] => 0 ) ) )
I want to get only the PIN numbers
just loop the array like this way :
foreach($data['Row'] as $item){ // $data is the array that contain all data
echo $item['PIN'];
}
if you want to store those pin numbers into an array :
$pins = array();
foreach($data['Row'] as $item){
$pins[]=$item['PIN'];
}
var_dump($pins); // that will show an array of pins [269,99,...]
If you want to convert the $pins array to json :
$pins_json= json_encode($pins,true);