note 28756 modified in function.strstr by victor

From: Date: Thu, 23 Jan 2003 11:01:02 +0000
Subject: note 28756 modified in function.strstr by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-42639@lists.php.net to get a copy of this message
[Editor's Note: It's better to: substr($stringA, 0, strpos($stringA, $toFind)+1) than to reverse the string twice (slow).] //If you want to get the text before the occurence of the character //you want to find, simply use the function strRev twice: $stringA = "user@example.com"; $toFind = "@"; echo strrev( strchr(strrev($stringA),$toFind) ); //output: user@ --was-- //If you want to get the text before the occurence of the character //you want to find, simply use the function strRev twice: $stringA = "user@example.com"; $toFind = "@"; echo strrev( strchr(strrev($stringA),$toFind) ); //output: user@ http://www.php.net/manual/en/function.strstr.php

« previous php.notes (#42639) next »