3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr= ["clownfish.jpg", "clownfish-150x150.jpg", "b800-768x575.jpg", "b800-4.jpg", "b800.jpg", "agility_3.jpg", "agility_3-45x45.jpg", "hundezubehör-für-sommer.jpg"]; $find = "hundezubehör-für-sommer.jpg"; var_dump(in_array($find, $arr)); Foreach($arr as $key => $item){ $length = min(strlen($item), strlen($find))-4; // lenght of the smallest string - ".jpg" if(levenshtein(substr($item,0,$length), substr($find,0,$length), 1,1,0) == 0){ //is it the same file $len = [strlen($item) => $item, strlen($find) => $find]; // make a associative array with lenght as key $minkey = min(array_keys($len)); // find the smallest of them $new[] = $len[$minkey]; // add the smallest to the new array } } Var_dump(array_unique($new)); // remove duplicates
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) array(1) { [0]=> string(29) "hundezubehör-für-sommer.jpg" }

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