note 42934 modified in function.str-replace by aidan

From: Date: Sat, 26 Jun 2004 13:57:52 +0000
Subject: note 42934 modified in function.str-replace by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71764@lists.php.net to get a copy of this message
An easy way to convert email addresses to the PHP.net comment-style email addresses: <? $email = "john@doe.org"; $search = array('@', '.'); $replace = array(" at ", " dot "); $result = str_replace($start, $end, $email); ?> Outputs: john at doe dot org --was-- An easy way to convert email addresses to the PHP.net comment-style email addresses: <? $email = "john@doe.org"; /* * Declare the start array * chr(64) = "@" * chr(46) = "." */ $start = array(chr(64), chr(46)); /* * Declare the end array */ $end = array(" at ", " dot "); /* * Perform the replace */ $result = str_replace($start, $end, $email); /* * outputs: john at doe dot org */ ?> http://php.net/manual/en/function.str-replace.php

« previous php.notes (#71764) next »