[ create a new paste ] login | about

Link: http://codepad.org/DPni4MqP    [ raw code | output | fork ]

PHP, pasted on Aug 23:
1
2
3
4
5
6
7
8
9
10
11
12
<?php
$string = 'The ? ? fox jumped over the ? dog.';
$patterns = array();
$patterns[0] = '/[?]/';
$patterns[1] = '/[?]/';
$patterns[2] = '/[?]/';
$replacements = array();
$replacements[2] = 'quick?';
$replacements[1] = 'brown';
$replacements[0] = 'lazy';
echo preg_replace($patterns, $replacements, $string);
?>


Output:
1
The quickbrown quickbrown fox jumped over the quickbrown dog.


Create a new paste based on this one


Comments: