Re: Fw: [PHP] Loooooooooonnnnnnnnnnggggggggg
| From: | Marek Kilimajer | Date: | Wed, 20 Nov 2002 10:29:50 +0000 |
| Subject: | Re: Fw: [PHP] Loooooooooonnnnnnnnnnggggggggg | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125212@lists.php.net to get a copy of this message | ||
Yes, I got it wrong, use strpos instead of strrpos
Tristan Carron wrote:
yes it does returns the string before the first * Your script returns string before the last * How to inverse that ? ----- Original Message ----- From: "Marek Kilimajer" <kilimajer@webglobe.sk> Newsgroups: php.general To: "PHP" <php-general@lists.php.net> Sent: Tuesday, November 19, 2002 2:30 PM Subject: Re: Fw: [PHP] LoooooooooonnnnnnnnnngggggggggThe answers will come in faster if you tell us how you're "processing"Your function seems to return string before first occurence of '*'. This should be faster: function conte($string) { return substr($string,0,strrpos($string,'*')); } Tristan Carron wrote:could----- Original Message ----- From: "Justin French" <justin@indent.com.au> To: "Tristan Carron" <tcarron@bsv.fr> Sent: Tuesday, November 19, 2002 12:23 PM Subject: Re: [PHP] LoooooooooonnnnnnnnnngggggggggYou should post this to the list, not me direct :) Justin on 19/11/02 10:10 PM, Tristan Carron (tcarron@bsv.fr) wrote:sorry i forgot the script (excuse me, but i'm dumb) As the full code is too long, i'll just give u a function that i thinkbe better, there you go (good luck): function conte($string){ $number=l($string); $i=0; $url_modif=""; while($i<$number-1){ if($string[$i]=="*"){ for($j=0;$j<=$i-1;$j++){ $url_modif=$url_modif.$string[$j]; } return $url_modif; break; } else{ $i++; } } if(($string!=$url_modif) && ((strlen($url_modif))=="0")){ return $string; } else { return $url_modif; } } ----- Original Message ----- From: "Justin French" <justin@indent.com.au> Newsgroups: php.general To: "Hacook" <hacook@free.fr>; <php-general@lists.php.net> Sent: Tuesday, November 19, 2002 12:09 PM Subject: Re: [PHP] Loooooooooonnnnnnnnnngggggggggon 19/11/02 10:00 PM, Hacook (hacook@free.fr) wrote:Do you have any tips to make it faster ?
it.
Justin French -------------------- http://Indent.com.au Web Developent & Graphic Design --------------------
Justin French
--------------------
http://Indent.com.au
Web Developent &
Graphic Design
--------------------