You can pass the output of print_r array to a string using this way
$array = ["apple", "banana", "cherry"];
$str = print_r($array, true);
true arg will allow to pass the output to string without actually printing the output of the array.
You can pass the output of print_r array to a string using this way
true arg will allow to pass the output to string without actually printing the output of the array.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.