Skip to content
Advertisement

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:

JavaScript

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

JavaScript

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

JavaScript

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?

Advertisement

Answer

you are getting value in another array like this

JavaScript

to get the inner value you have to access it like this:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement