How would I print the following in one line?
$product_array = array(
"id" => 001,
"description" => "phones",
"type" => "iphone"
);
print "Print the product_array = ";
print_r($product_array);
Current result
Print the product_array =Array
(
[id] => 001
[description] => phones
[type] => iphone
)
Wanted Result
Print the product_array =Array ( [id] => 001 [description] => phones [type] => iphone )
$arrayString = print_r($array, true);
echo str_replace("\n", "", $arrayString);
The second value of print_r lets the function return the value instead of printing it out directly.