3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TextTest { public function entities($str) { return htmlentities($str); } } $answerset = array('answers'=>array(50=>array('answerlong'=>'some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!some super long crazy long string that really shouldn\'t be so long, but it is anyway!'))); $text = new TextTest(); ob_start(); $time = microtime(1); $i = 0; while($i++ < 10000) echo'<td>',$text->entities($answerSet['answers'][$questionId]['answerLong']),'</td>'; ob_end_clean(); echo (microtime(1)-$time)." seconds for commas"; echo "\n"; ob_start(); $time = microtime(1); $i = 0; while($i++ < 10000) echo'<td>'.$text->entities($answerSet['answers'][$questionId]['answerLong']).'</td>'; ob_end_clean(); echo (microtime(1)-$time)." seconds for dot";

preferences:
23.41 ms | 402 KiB | 5 Q