Created
August 19, 2011 14:23
-
-
Save sole/1156911 to your computer and use it in GitHub Desktop.
Testing double spaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$txt = ''; | |
$pasted_text = ''; | |
if($_SERVER['REQUEST_METHOD'] == 'POST') | |
{ | |
$pasted_text = $_POST['text']; | |
$text = str_replace("\n", '<span class="n"></span>' . "\n", $pasted_text); | |
$text = str_replace("\r", '<span class="r"></span>' . "\r", $text); | |
$txt = 'You pasted this:<br /><pre>' . $text . '</pre><br />(end of your paste)'; | |
} | |
?><!DOCTYPE HTML> | |
<html> | |
<head> | |
</head> | |
<body> | |
<?php echo $txt; ?> | |
<form action="" method="post"> | |
<textarea name="text" placeholder="PASTE SOMETHING HERE, press submit" rows="20" cols="80"><?php echo $pasted_text; ?></textarea><br /> | |
<input type="submit" value="submit" /> | |
</form> | |
<style> | |
pre { | |
background: #eee; | |
font-family: Monaco,"Andale Mono","Bitstream Mono",Courier,terminal; | |
font-size: 12px; | |
height: auto; | |
line-height: 1; | |
padding: 10px; | |
width: auto; | |
max-width: 99%; | |
} | |
.n { | |
padding: 0 10px; | |
background: #f00; | |
} | |
.r { | |
padding: 0 10px; | |
background: #0f0; | |
} | |
</style> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment