note 26477 added to function.strstr
| From: | crypto at notup2u dot net | Date: | Fri, 01 Nov 2002 01:33:25 +0000 |
| Subject: | note 26477 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38849@lists.php.net to get a copy of this message | ||
Here is a small command to get the beginning of a string until another string. This is a bit like
strstr() but it returns the beginning and not the end of the string !
Voici une petite commande pour obtenir le début d'une chaine de charactères jusqu'à une
autre chaine. C'est un peu comme strstr() mais celà retourne le début et non la fin de la
chaine !
$string = "email@domain.net";
$separat = "@";
$string = substr($string, 0, strlen($string)-strlen (strstr ($string,$separat)));
// $string : "email"
/Crypto
--
http://www.php.net/manual/en/function.strstr.php
http://master.php.net/manage/user-notes.php?action=edit+26477
http://master.php.net/manage/user-notes.php?action=delete+26477
http://master.php.net/manage/user-notes.php?action=reject+26477