'Convert an array to string using PHP

Still new in PHP and I am trying to convert an array to string in my code below:

$totalProfitsArray = print_r($profits['totalProfit']);

If I echo the $totalProfitsArray variable above i get this result:

Array ( [0] => Array ( [count] => 44.35 ) )  

which is fine but i want to echo only the 44.35 value. So i tried to use the implode method like this:

implode("", $totalProfitsArray);

but still didn't work and i get this error:

implode(): Invalid arguments passed

What I am doing wrong? Is there any other easy way to convert the array in string and print the result?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source