Re: turn off the www

From: Date: Wed, 29 Jun 2005 20:16:04 +0000
Subject: Re: turn off the www
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-217857@lists.php.net to get a copy of this message
OK OK I got it ;) I just suggested it because I thought he could assume that "www." would always be on the string. Either way, I guess _one_ preg_replace is alright.
Heh :-) Just for kicks... - randomly prefix "www." onto 1324 proper names (dictionary file). 659 end up with "www." prefixed. - wrote a script to load them all up into an array, then loop through doing an ereg, substr, and preg. Each block looks like this: reset($ary); $stime = microtime(true); foreach ( $ary as $w ) { $w = ereg_replace("^www\.", "", $w); } $etime = microtime(true); $ttime = $etime - $stime; print("ereg_replace: $ttime\n"); The only differenec being the line in the foreach loop. Ran it several times on a fairly quite box and always got pretty similar results... ereg_replace: 0.0057849884033203 substr: 0.0025739669799805 preg_replace: 0.004335880279541 Anyway... there's some stats for the archive :-)
On 6/29/05, Kevin L'Huillier <klhuillier@gmail.com> wrote:
Wouldn't $newUrl = 'https://' . substr( $_SERVER['SERVER_NAME'], 4 ) ........ be a _hell_ of a lot faster?
If one considers micro-seconds 'a _hell_ of a lot faster', then _maybe_
And it could be slower if you avoid sending someone from http://example.com/ to https://ple.com/ by adding a substring check. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#217857) next »