3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo ' <div class="content_box"><b>Random Spawn Array Generator - Generates a random spawn array from SavedPositions.txt!</b></div> <form method="POST" name="editor"> <textarea name="code" cols="80" rows="30" class="paste_textarea">'; if(!empty($_POST['code'])) { $text = $_POST['code']; $text = explode("\n",$text); $incAngles = $_POST['incAngles']; $counter = 0; $string = ""; for($i = 0; $i < sizeof($text); $i++) { $sText = explode(",",$text[$i]); if(empty($sText[1]) || empty($sText[2]) || empty($sText[3]) || empty($sText[4])) continue; if($incAngles == "on") if($i != sizeof($text) - 1) $string .= " {".$sText[1].",".$sText[2].",".$sText[3].",".$sText[4]."},\n"; else $string .= " {".$sText[1].",".$sText[2].",".$sText[3].",".$sText[4]."}\n"; else if($i != sizeof($text) - 1) $string .= " {".$sText[1].",".$sText[2].",".$sText[3]."},\n"; else $string .= " {".$sText[1].",".$sText[2].",".$sText[3]."}\n"; $counter++; } echo "new Float:".$_POST['format']."[".$counter."][".($incAngles == "on" ? "4" : "3")."] = {\n"; echo $string; echo '};'; } echo '</textarea> <div class="form_frame"> <div class="form_left"> Array name: </div> <div class="form_right"> <input type="text" value="randomSpawns" name="format" size="20" class="post_input"> </div> <div class="form_left"> Include angles: </div> <div class="form_right"> <input type="checkbox" name="incAngles"> </div> </div> <input type="submit" value="Split String" name="Submit"> </form>'; ?>
Output for 4.3.0 - 7.1.0
<div class="content_box"><b>Random Spawn Array Generator - Generates a random spawn array from SavedPositions.txt!</b></div> <form method="POST" name="editor"> <textarea name="code" cols="80" rows="30" class="paste_textarea"></textarea> <div class="form_frame"> <div class="form_left"> Array name: </div> <div class="form_right"> <input type="text" value="randomSpawns" name="format" size="20" class="post_input"> </div> <div class="form_left"> Include angles: </div> <div class="form_right"> <input type="checkbox" name="incAngles"> </div> </div> <input type="submit" value="Split String" name="Submit"> </form>