Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 12, 2019 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/902551eef8cfd67fdb5a9e63218630f3 to your computer and use it in GitHub Desktop.
Save parzibyte/902551eef8cfd67fdb5a9e63218630f3 to your computer and use it in GitHub Desktop.
<?php
/*
Convertir arreglo a cadena en PHP (unir arreglo)
https://parzibyte.me/blog
*/
$arreglo = array(
"Son of a preacher Man",
"Crocodile Rock",
"Who made who",
"Play the game",
"Blue Jean",
);
$pegamento = ","; // Una coma, aunque podríamos dejar la cadena vacía
$cadena = implode($arreglo, $pegamento);
var_dump($cadena);
/*
Salida:
string(63) "Son of a preacher Man,Crocodile Rock,Who made who,Play the game"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment