3v4l.org

run code in 300+ PHP versions simultaneously
<?php $name1 = 'The cat is red and wet'; $name2 = 'The cat is green and wet'; function stringDiff($string1, $string2) { $x = str_split($string1); $y = str_split($string2); $diff = array_diff($x, $y); foreach ($diff as $letter) { $string1 = str_replace($letter, '-', $string1); } return $string1; } var_dump(stringDiff($name1, $name2));
Output for git.master, git.master_jit, rfc.property-hooks
string(22) "The cat is red and wet"

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