I have an array by the name - $products, and have some values in it.
$contents = "Hello This is test - " . foreach($products as $temp_p) { echo $temp_p; } . " - OK.";
echo $contents;
I don’t know what’s wrong going in this, (I am getting parse error in the above like, where I have defined the foreach loop). So what else method is left for trying, and doing this hence?
I want to get the values within one variable, in above code, as we are getting in below example,
$contents = "Hello This is test - " . strtoupper("hello") . " - With simple function inside.";
echo $contents;
By the way, you’re missing a quote on your first param of the implode() function… it should be implode(“”, $array) <– the first param is your delimiter, in this case an empty string.