3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ "this is a sample test" => "asample test", "sample test1 \n new line content" => "test1 new" ]; $whitechars=[' ',"\t","\r","\n"]; foreach ($tests as $input => $check) { $pattern='~'.preg_replace('~\S(?!$)\K\s*~','\s*',$check).'~'; if(preg_match($pattern,$input)){ echo "Using Pattern: ($pattern) Found: "; }else{ echo "Did Not Find: "; } /* if (strpos(preg_replace('~\s+~', '', $input), preg_replace('~\s+~', '', $check))!==false){ echo "Found: "; }else{ echo "Did Not Find: "; } */ /* if (strpos(str_replace($whitechars, '', $input), str_replace($whitechars, '', $check))!==false){ echo "Found: "; }else{ echo "Did Not Find: "; } */ echo "$check IN $input"; echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Using Pattern: (~a\s*s\s*a\s*m\s*p\s*l\s*e\s*t\s*e\s*s\s*t~) Found: asample test IN this is a sample test --- Using Pattern: (~t\s*e\s*s\s*t\s*1\s*n\s*e\s*w~) Found: test1 new IN sample test1 new line content ---

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:
156.71 ms | 406 KiB | 5 Q