3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverseEnglishWords($string) { return preg_replace_callback('/(?!\s)[^\p{Arabic}\r\n]+/u', function ($m) { $tmp = preg_replace_callback('~(\w+)([^\w\s]+)~', function($n) { return strrev($n[2]) . $n[1]; }, $m[0]); return implode(" ", array_reverse( preg_split('~\s+~u', $tmp, -1, PREG_SPLIT_NO_EMPTY) ) ); }, $string); } $s = " این یک تست جدید است Is my English line working just fine? I hope it does... Another one?! این یک جمله جدید است and this is to be continued in English... "; echo reverseEnglishWords($s);
Output for git.master, git.master_jit, rfc.property-hooks
این یک تست جدید است ?fine just working line English my Is ...does it hope I !?one Another این یک جمله جدید است ...English in continued be to is this and

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:
174.32 ms | 405 KiB | 5 Q