Created
August 20, 2019 23:39
-
-
Save parzibyte/6a27089bc970007f337d8f4dddabd6d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Cortar cadenas en PHP | |
@author parzibyte | |
https://parzibyte.me/blog | |
*/ | |
$uri = "http://localhost/plantilla-php/usuarios?token=asdfg123"; | |
echo "uri antes: $uri"; | |
$posicionSignoDeInterrogacion = strpos($uri, "?"); | |
if ($posicionSignoDeInterrogacion !== false) { | |
$uri = substr($uri, 0, $posicionSignoDeInterrogacion); | |
} | |
echo "\n\nuri después: $uri"; | |
/* | |
Salida: | |
uri antes: http://localhost/plantilla-php/usuarios?token=asdfg123 | |
uri después: http://localhost/plantilla-php/usuarios | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment