So I had some output in this format:
array (
'job' => 'Illuminate\\Queue\\CallQueuedHandler@call',
'data' =>
array (
'commandName' => 'App\\Jobs\\SampleJob',
'command' => 'O:21:"App\\Jobs\\SampleJob":5:{s:10:"' . "\0" . '*' . "\0" . 'post";O:45:"Illuminate\\Contracts\\Database\\ModelIdentifier":2:{s:5:"class";s:18:"App\\Models\\Post";s:2:"id";i:28711;}s:10:"connection";N;s:5:"queue";N;s:5:"delay";N;s:6:"' . "\0" . '*' . "\0" . 'job";N;}',
),
)
I need to access the id
value (28711) under command
.
So I unserialized it:
$output = (array) unserialize($event->data['data']['command']);
Now, when I print the array keys of this array, it gives me:
array (
0 => '' . "\0" . '*' . "\0" . 'post',
1 => 'connection',
2 => 'queue',
3 => 'delay',
4 => '' . "\0" . '*' . "\0" . 'job',
)
How am I supposed to access the first key's values?