3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getSimilarSubstring($a, $b) { if(!strlen($a) || !strlen($b)) { return ''; } if(false!==strpos($a, $b)) { return $b; } $length = strlen($b); for($i=$length-1; $i>0; $i--) { for($j=0; $j<$length-$i; $j++) { if($result = getSimilarSubstring($a, substr($b, $j, $i))) { return $result; } } } return ''; } //$word_a = "superman"; //$word_b = "stermastein"; $word_a = 'afk'; $word_b = 'fk'; var_dump(getSimilarSubstring($a, $b));
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $a in /in/U0ejN on line 33 Warning: Undefined variable $b in /in/U0ejN on line 33 Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /in/U0ejN on line 4 string(0) ""

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:
44.64 ms | 401 KiB | 8 Q