Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Last active July 12, 2019 22:02
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/58bc289d5b023bbb945e7b80b670130c to your computer and use it in GitHub Desktop.
Save parzibyte/58bc289d5b023bbb945e7b80b670130c to your computer and use it in GitHub Desktop.
<?php
/*
Separar cadena usando delimitadores en PHP
https://parzibyte.me/blog
*/
$cadena = "Blue Jean
The Jean Genie
Stray Cat Strut
Fashion
Rock this town";
$separador = "\n"; // Usar salto de línea
$separada = explode($separador, $cadena);
var_dump($separada);
/*
Salida:
array(5) {
[0]=>
string(9) "Blue Jean"
[1]=>
string(14) "The Jean Genie"
[2]=>
string(15) "Stray Cat Strut"
[3]=>
string(7) "Fashion"
[4]=>
string(14) "Rock this town"
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment