Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 12, 2019 21:57
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/5047ae48373d698e9551587f7e79667d to your computer and use it in GitHub Desktop.
Save parzibyte/5047ae48373d698e9551587f7e79667d to your computer and use it in GitHub Desktop.
<?php
/*
Separar cadena usando delimitadores en PHP
https://parzibyte.me/blog
*/
$cadena = "Hola mundo-Soy otra oración-Me gusta PHP";
$separador = "-";
$separada = explode($separador, $cadena);
var_dump($separada);
/*
Salida:
array(3) {
[0]=>
string(10) "Hola mundo"
[1]=>
string(17) "Soy otra oración"
[2]=>
string(12) "Me gusta PHP"
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment