3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ydd_api_prefix = '7-'; $items = ['123', '456', '7-123', '7-432']; $referenced_nids = array_reduce($items, function ($return, $yle_id) use ($ydd_api_prefix) { if (strpos($yle_id, $ydd_api_prefix) === 0) { $return[] = substr($yle_id, strlen($ydd_api_prefix)); } return $return; }, []); var_dump($referenced_nids);