No subject
Sat Jan 27 12:34:08 EST 2007
mixed *str_replace* ( mixed search, mixed replace, mixed subject [, int
&count] )
This function returns a string or an array with all occurrences of *search*in
*subject* replaced with the given *replace* value. If you don't need fancy
replacing rules (like regular expressions), you should always use this
function instead of
ereg_replace()<http://hu.php.net/manual/en/function.ereg-replace.php>or
preg_replace() <http://hu.php.net/manual/en/function.preg-replace.php>.
On 2/5/07, oscar at devel.lifetype.net <oscar at devel.lifetype.net> wrote:
>
> Author: oscar
> Date: 2007-02-05 17:15:16 -0500 (Mon, 05 Feb 2007)
> New Revision: 4693
>
> Modified:
> plog/branches/lifetype-1.2
> /class/net/http/session/sessionmanager.class.php
> Log:
> Added Jon's fix
>
>
> Modified: plog/branches/lifetype-1.2
> /class/net/http/session/sessionmanager.class.php
> ===================================================================
> --- plog/branches/lifetype-1.2/class/net/http/session/sessionmanager.class.php 2007-02-05
> 21:49:03 UTC (rev 4692)
> +++ plog/branches/lifetype-1.2/class/net/http/session/sessionmanager.class.php 2007-02-05
> 22:15:16 UTC (rev 4693)
> @@ -104,7 +104,7 @@
> $scriptUrl = HttpVars::getBaseUrl();
>
> $url = new Url( $scriptUrl );
> - $domain = str_replace( "www.", ".",
> $url->getHost());
> + $domain = preg_replace("/^www\./", ".",
> $url->getHost());
>
> // this won't work for top level domains and
> domains such as
> // 'localhost' or internal domains for obvious
> security reasons...
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>
------=_Part_71233_14575559.1170716462154
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
preg_replace take significantly more time (and memory) to execute than str_replace... just wondering what your rationale for this was...<br><br>From PHP Website:<br>mixed <b>str_replace</b> ( mixed search, mixed replace, mixed subject [, int &count] )
<br>
This function returns a string or an array with all occurrences of
<i><tt>search</tt></i> in <i><tt>subject</tt></i>
replaced with the given <i><tt>replace</tt></i> value. If you
don't need fancy replacing rules (like regular expressions), you should
always use this function instead of <a href="http://hu.php.net/manual/en/function.ereg-replace.php">ereg_replace()</a> or
<a href="http://hu.php.net/manual/en/function.preg-replace.php">preg_replace()</a>.<br><br><div><span class="gmail_quote">On 2/5/07, <b class="gmail_sendername"><a href="mailto:oscar at devel.lifetype.net">oscar at devel.lifetype.net
</a></b> <<a href="mailto:oscar at devel.lifetype.net">oscar at devel.lifetype.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Author: oscar<br>Date: 2007-02-05 17:15:16 -0500 (Mon, 05 Feb 2007)<br>New Revision: 4693<br><br>Modified:<br> plog/branches/lifetype-1.2/class/net/http/session/sessionmanager.class.php<br>Log:<br>Added Jon's fix<br>
<br><br>Modified: plog/branches/lifetype-1.2/class/net/http/session/sessionmanager.class.php<br>===================================================================<br>--- plog/branches/lifetype-1.2/class/net/http/session/sessionmanager.class.php 2007-02-05 21:49:03 UTC (rev 4692)
<br>+++ plog/branches/lifetype-1.2/class/net/http/session/sessionmanager.class.php 2007-02-05 22:15:16 UTC (rev 4693)<br>@@ -104,7 +104,7 @@<br> $scriptUrl = HttpVars::getBaseUrl();<br><br>
$url = new Url( $scriptUrl );<br>- $domain = str_replace( "www.", ".", $url->getHost());<br>+ $domain = preg_replace("/^www\./", ".", $url->getHost());
<br><br> // this won't work for top level domains and domains such as<br> // 'localhost' or internal domains for obvious security reasons...<br><br>_______________________________________________
<br>pLog-svn mailing list<br><a href="mailto:pLog-svn at devel.lifetype.net">pLog-svn at devel.lifetype.net</a><br><a href="http://limedaley.com/mailman/listinfo/plog-svn">http://limedaley.com/mailman/listinfo/plog-svn</a><br></blockquote>
</div><br>
------=_Part_71233_14575559.1170716462154--
More information about the pLog-svn
mailing list