Blog de programación, errores, soluciones

PHP implode

PHP implode function permit us convert an arrray into a String, but the term correct is that impode make a union($glue) between the array elements creating a string.

This function recives 2 parameters, $glue and the $array.

Syntax :

implode($glue,$array);

Let’s make a little example, suppose we have a list of users and i need a list like: Luis, Gastón, Claudia, Jenie, Alexandra, etc.

<?php
$usuarios =array("Luis", "Gastón", "Claudia", "Jenie", "Alexandra");
$lista = implode(", ", $usuarios);
echo "$lista";
?>

Referencia: php.net

Mas links: explode

Somethig wrong? If you found an error or mistake on the content you can contact me on twitter | @luisg2249_luis.
Last 4 post in same category