Last active
March 3, 2019 14:22
-
-
Save charliewilson/626e0f1f66bce6407c58da7f65a885ce to your computer and use it in GitHub Desktop.
Mocking Spongebob Meme Generator
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 | |
if ($_POST['intext']!="") { | |
$instring = htmlentities($_POST['intext']); | |
} else { | |
$instring = "Type your text here."; | |
} | |
$firstpass = str_split($instring); | |
$outstring = ""; | |
for ($i = 0; $i < strlen($instring); $i++) { | |
if ($i == 0) { | |
$outstring[$i] = strtoupper($firstpass[$i]); | |
} | |
elseif (ctype_upper($outstring[$i-1])) { | |
if (mt_rand(0,3) == 2) { | |
$outstring[$i] = strtoupper($firstpass[$i]); | |
} | |
else { | |
$outstring[$i] = strtolower($firstpass[$i]); | |
} | |
} | |
else { | |
if (mt_rand(0,3) == 2) { | |
$outstring[$i] = strtolower($firstpass[$i]); | |
} | |
else { | |
$outstring[$i] = strtoupper($firstpass[$i]); | |
} | |
} | |
} | |
$final = implode("",$outstring); | |
?> | |
<html> | |
<head> | |
<meta name="viewport" content="width=420, initial-scale=1.0"> | |
<title>spOnGEbOB</title> | |
</head> | |
<body> | |
<form method="post" action="spongememe.php"> | |
<input style="width:400px; font-size:24px;" type="text" name="intext" placeholder="Type your text here." /><br> | |
<button type="submit">Generate</button> | |
</form> | |
<br /><br /> | |
<span style="display:block; width: 400px; font-size: 27px; line-height: 32px; font-weight: 300; letter-spacing: .01em; font-family:Arial, Helvetica Neue;">"<?php echo $final ?>"</span><br> | |
<img style="width:400px" src="sponge.jpg" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Warning: implode(): Invalid arguments passed in /home/blutvclone/www/index.php on line 50
:(