This option will reset the home page of this site. Restoring any closed widgets or categories.

Reset

Replacing a string using php

Simple code to replace a string using a very simple approach.

You can’t do this with ereg_replace, but you can with preg_replace.


<?
$var 
‘abcdef abcdef abcdef’;

// pattern, replacement, string
echo ereg_replace(‘abc’‘123′$var); // outputs ’123def 123def 123def’

// pattern, replacement, string, limit
echo preg_replace(‘/abc/’‘123′$var1); // outputs ’123def abcdef abcdef’
?>

VN:F [1.5.7_846]
Rating: 0.0/10 (0 votes cast)
VN:F [1.5.7_846]
Rating: 0 (from 0 votes)

Related posts:

  1. How to get the query string value in perl cgi script
  2. Appending string using php to a text file

Leave a Reply

Comments (required)

Spam Protected