I'm trying to implode variables, but it's not working correctly:
$models = array("$model0, $model1");
$modelfinal = implode("," , $models);
$modelfinal only returns , ,
I'm guessing I'm way off...anybody?
The following statement creates an array with exactly one string in it, which is comprised of the values of two (apparently) undefined variables separated with a comma:
$models = array("$model0, $model1");
The end result is the same as if you had done this:
$models = array(", ");
Now you're imploding it using a comma as the separator, which doesn't do anything since there's only one element in the array (a string with a comma and a space).
Assuming $model0 and $model1 are defined (which is a problem you'll need to look into first), you can get your desired result either by:
$modelfinal = "$model0, $model1", $models = array($model0, $model1); followed by the implode.here is your problem "$model0, $model1" change it to this code
$models = array($model0,$model1);
array($model0, $model1)? Yuck., ,, which obviously means there's an issue with $model0 and $model1 as well as thisarray for two element not one. is is very strange to convert a string to array , then implode that to string again !!
$modelsmeant to have only one element, or is that a typo?"$model0, $model1"Shouldn’t take anything more.$model0and$model1, what doesvar_dump($model0, $model1)returns?