[ create a new paste ] login | about

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

PHP, pasted on Sep 13:
1
2
3
4
5
6
<?php
$input='foo/bar#baz';
$array = array("#" => "_", "/" => "-");
$output = preg_replace('@([a-z][#/])@e', '"<span>".strtr("$0", $array)."</span>"', $input);
var_dump($output);
?>


Output:
1
string(37) "fo<span>o-</span>ba<span>r_</span>baz"


Create a new paste based on this one


Comments: