3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '/^(\b\w+\b).*\b\1\b.*/i'; //should match $string = "TheseCharacters, I really enjoy TheseCharacters"; $result = preg_match($pattern, $string, $matches); echo "String 1 matches {$result} times: ".print_r($matches,true)."\n"; //should match $string = "TheseCharacters, I really enjoy TheseCharacters"; $result = preg_match($pattern, $string, $matches); echo "String 1 matches {$result} times: ".print_r($matches,true)."\n"; //match only with case insensitive flag, not an exact match in case $string = "TheseCharacters, I really enjoy TheseCharacters and some others"; $result = preg_match($pattern, $string, $matches); echo "String 2 matches {$result} times: ".print_r($matches,true)."\n"; //no match, TheseCharacters has been changed to TheseLetters $string = "TheseCharacters, I really enjoy TheseLetters"; $result = preg_match($pattern, $string, $matches); echo "String 3 matches {$result} times: ".print_r($matches,true)."\n"; //no match, additional letters has been added to TheseCharacters $string = "TheseCharacters, I really enjoy TheseCharactersasdf"; $result = preg_match($pattern, $string, $matches); echo "String 4 matches {$result} times: ".print_r($matches,true)."\n";
Output for git.master, git.master_jit, rfc.property-hooks
String 1 matches 1 times: Array ( [0] => TheseCharacters, I really enjoy TheseCharacters [1] => TheseCharacters ) String 1 matches 1 times: Array ( [0] => TheseCharacters, I really enjoy TheseCharacters [1] => TheseCharacters ) String 2 matches 1 times: Array ( [0] => TheseCharacters, I really enjoy TheseCharacters and some others [1] => TheseCharacters ) String 3 matches 0 times: Array ( ) String 4 matches 0 times: Array ( )

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:
69.75 ms | 402 KiB | 8 Q