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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -