note 93565 modified in function.strpos by danbrown

From: Date: Wed, 16 Sep 2009 16:51:06 +0000
Subject: note 93565 modified in function.strpos by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160750@lists.php.net to get a copy of this message
Function to get the string position before the pos passed: <?php function strposReverse( $str, $search, $pos ){ $str = strrev($str); $search = strrev($search); $pos = (strlen($str) - 1) - $pos; $posRev = strpos( $str, $search, $pos ); return (strlen($str) - 1) - $posRev - (strlen($search) - 1); } ?> --was-- Function to get the string position before the pos passed: function strposReverse( $str, $search, $pos ){ $str = strrev($str); $search = strrev($search); $pos = (strlen($str) - 1) - $pos; $posRev = strpos( $str, $search, $pos ); return (strlen($str) - 1) - $posRev - (strlen($search) - 1); } http://php.net/manual/en/function.strpos.php

« previous php.notes (#160750) next »