For beginners - http://php.net/
Very useful site.
User Profile
Collapse
-
This will replace the entire string,includin g the braces.
$string = " {this} chocolate belongs to {that} boy";
$pattern = "/({[^}]+})/i";
preg_match_all( $pattern,$strin g,$result);
$values = $result[1];
$replace_variab le = array('rep1', 'rep2');
$newphrase = str_replace($va lues, $replace_variab le, $string);
echo "<br> String : ".$string;
echo...Leave a comment:
-
This will helpful for replacing strings in the braces.
<?php
$string = " {this} chocolate belongs to {that} boy";
$pattern = "/{([^}]+)}/i";
preg_match_all( $pattern,$strin g,$result);
$values = $result[1];
$replace_variab le = array('rep1', 'rep2');
$newphrase = str_replace($va lues, $replace_variab le, $string);
echo "<br> String : ".$string;...Leave a comment:
No activity results to display
Show More
Leave a comment: