Implode variables in PHP -
i'm trying implode variables, it's not working correctly:
$models = array("$model0, $model1"); $modelfinal = implode("," , $models);
$modelfinal returns , ,
i'm guessing i'm way off...anybody?
the following statement creates array 1 string in it, comprised of values of 2 (apparently) undefined variables separated comma:
$models = array("$model0, $model1");
the end result same if had done this:
$models = array(", ");
now you're imploding using comma separator, doesn't since there's 1 element in array (a string comma , space).
assuming $model0
, $model1
defined (which problem you'll need first), can desired result either by:
- directly using
$modelfinal = "$model0, $model1"
, - or using
$models = array($model0, $model1);
followed implode.
Comments
Post a Comment