All pastes #667247 Raw Edit

Stuff

public text v1 · immutable
#667247 ·published 2007-08-22 20:54 UTC
rendered paste body

<?php
function simplecode($pre, $post, $target) {
    $target_arr = explode("\n", $target);
    $s = array();
    $result = "";
    foreach ($target_arr as $t):
        if (preg_match("/(<input.*\/>|<textarea.*>.*<\/textarea>)/", $t)):
            array_push($s, $t);
        else:
            $t = preg_replace($pre, $post, $t);
            array_push($s, $t);
        endif;
    endforeach;
    foreach ($s as $v):
        $result .= $v."
";
    endforeach;
//    $result = preg_replace($pre, $post, $target);
    return $result;
}  
?>