note 53534 deleted from function.stristr by cece

From: Date: Sun, 05 Jun 2005 08:55:12 +0000
Subject: note 53534 deleted from function.stristr by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-89936@lists.php.net to get a copy of this message
Note Submitter: notepad at codewalkers dot com ---- correction, sorry i'm tired. this version allows for multiple characters, duh! <?php // and backwards... function stristr_reverse($haystack, $needle) { $pos = stripos($haystack, $needle) + (strlen($needle) - 1); for($i = $pos; $i >= 0; $i--) @$str .= $haystack{$i}; return strrev($str); } $email = 'USER@EXAMPLE.com'; echo stristr_reverse($email, 'er'); // outputs USER ?>

« previous php.notes (#89936) next »