3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'Samsung UN32EH4003 32-inch 720p 60Hz LED HDTV (Black)'; echo shorten_string($string); function shorten_string($string,$count=5){ $arr = preg_split('/[,\ \.;]/', $string); $keywords = array_unique($arr); $i=0; $rtn = ''; foreach ($keywords as $keyword){ if ((preg_match("/^[a-z0-9]/", $keyword) ) && (strlen($keyword) > 3)){ $rtn .= $keyword.' '; $i++; if ($i==$count) break; } } return trim($rtn); }
Output for git.master, git.master_jit, rfc.property-hooks
32-inch 720p 60Hz

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