<?php // $source_code = "\nprint('Hello\nTest 123\nWorld')\n"; $source_code = "x=input()\nprint('Hello\nWorld')\n"; $match = preg_match('/(["\'])(.*)\1/s', $source_code, $matches); if ($match) { $text = $matches[2]; $text = str_replace("\n", '\\\\n', $text); $source_code = preg_replace('/(.*)((["\']).*\3)(.*)/s', '$1$3' . addslashes($text) . '$3$4', $source_code); } var_dump($source_code);
You have javascript disabled. You will not be able to edit any code.