3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wordSafeSplit(string $text, int $pieces = 2): array { $maxLength = intdiv(strlen($text), $pieces); return preg_split( "~.{0,$maxLength}\K\s~s", $text, $pieces ); } $text = "The Quick : Brown Fox Jumped Over The Lazy / Dog"; var_export(wordSafeSplit($text));
Output for git.master_jit, git.master, rfc.property-hooks
array ( 0 => 'The Quick : Brown Fox', 1 => 'Jumped Over The Lazy / Dog', )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
75.76 ms | 405 KiB | 5 Q