Answer the question
In order to leave comments, you need to log in
How to properly convert an array?
I need to translate this array into php
{
"program_id": "CC1234",
"offerings": [{
"offering_id": "RP445555",
"location_id": "B2222"
}],
"member_id": "10000-01",
"registration_type": "online",
"dry_run": false
}
array(
"member_id" => $_COOKIE['m_'],
"program_id" => $program_id,
"offerings" => array(
"offering_id" => $offering_id,
"location_id" => $location_id
),
"registration_type" => "online"
)
Answer the question
In order to leave comments, you need to log in
[
"program_id" => "CC1234",
"offerings": ,
"member_id" => "10000-01",
"registration_type" => "online",
"dry_run" => false
]
Use the json_decode function :
$json = '
{
"program_id": "CC1234",
"offerings": [{
"offering_id": "RP445555",
"location_id": "B2222"
}],
"member_id": "10000-01",
"registration_type": "online",
"dry_run": false
}';
$php_array = json_decode($json, true);
var_export($php_array);
array (
'program_id' => 'CC1234',
'offerings' =>
array (
0 =>
array (
'offering_id' => 'RP445555',
'location_id' => 'B2222',
),
),
'member_id' => '10000-01',
'registration_type' => 'online',
'dry_run' => false,
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question