rendered paste body<?php function slash_me ($str) { $out = ""; if(substr($str, 0, 4) == '/me ') { $idx_nl = strpos($str, "\n"); $out = '<span style="color:blue;">* foo ' . substr($str, 4, ($idx_nl-4)) . '</span>' . substr($str, $idx_nl); } else { $out = $str; } return $out; }?><?php $string = nl2br($_POST['string']); if (empty($string)) { echo "damn empty"; } else { echo slash_me($string); }?><form action="" method="post"><textarea name="string"></textarea><input type="submit" name="click" /></form>