3v4l.org

run code in 300+ PHP versions simultaneously
<?php $words = array( 'John Doe', 'Jane Adams', 'Michael McDonald', 'Jim' ); $initials = implode('/', array_map(function ($name) { return preg_replace('/(?<=\w)./', '', $name); }, $words)); echo $initials;

preferences:
35.43 ms | 406 KiB | 5 Q