3v4l.org

run code in 300+ PHP versions simultaneously
<?php $selfTable = 'songs'; $tables = array( 'types' => 'layout_template_types' ); $string = '$content AS content, CONCAT_WS( ".", $types.alias, layout_templates.custom_item_id ), id'; echo preg_replace_callback('#\$([\w]+)\.([\w]+)#', function($match) use ($tables) { return '`' . $tables[$match[1]] . '`.`' . $match[2] . '`'; }, $string);

preferences:
31.62 ms | 402 KiB | 5 Q