deharvy
asked on
Adding Values to an Array
How can I add a key/value set to an array?
I tried using array_push, but it doesn't seem to be working. Here is what I tried:
$string = "300=>null";
$data = array( '200'=>null );
array_push($data, $string );
print_r($data);
My results are:
Array ( [200] => [201] => '300'=>null )
I'd like my results to be:
Array ( [200] => [300] => )
Any assistance is greatly appreciated.
I tried using array_push, but it doesn't seem to be working. Here is what I tried:
$string = "300=>null";
$data = array( '200'=>null );
array_push($data, $string );
print_r($data);
My results are:
Array ( [200] => [201] => '300'=>null )
I'd like my results to be:
Array ( [200] => [300] => )
Any assistance is greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER