Ge64
12-18-2006, 08:12 AM
I want to use this code to add a \ to the end of every line in a peice of HTML code:
<?php
if (isset($_POST['input'])) {
$input = $_POST['input'];
$var = explode('\n', $input);
for ($i = 0; $i <= (count($var)-1); $i++) {
$var[$i] .= '\';
}
$output = implode('\n', $var);
}
?>
When I run it (even without an input) i get this:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\Webserver Root\forum\formatscript.php on line 12
Parse error: parse error, unexpected T_STRING in C:\Webserver Root\forum\formatscript.php on line 12
<?php
if (isset($_POST['input'])) {
$input = $_POST['input'];
$var = explode('\n', $input);
for ($i = 0; $i <= (count($var)-1); $i++) {
$var[$i] .= '\';
}
$output = implode('\n', $var);
}
?>
When I run it (even without an input) i get this:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in C:\Webserver Root\forum\formatscript.php on line 12
Parse error: parse error, unexpected T_STRING in C:\Webserver Root\forum\formatscript.php on line 12