3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "and with strange aeons even {{noun}} may {{verb}}"; $data = ['noun' => 'bird', 'verb' => 'fly']; $pattern = '/{{(' . implode('|', array_keys($data)) . ')}}/i'; echo preg_replace_callback($pattern, function($m) use($data){ return $data[strtolower($m[1])]; }, $str);

preferences:
109.11 ms | 407 KiB | 5 Q