3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'hellolleh'; function up($str) { return substr($str,0,(1+strlen($str))/2); } echo up($str);

preferences:
61.55 ms | 402 KiB | 5 Q