3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Models = [ 'users' => 'm_users', 'products' => 'm_products', 'customers' => 'm_customers']; $string = "SELECT users as Name,`users`.`family` AS Family, products.id AS PID, `customers`.`id` AD CID FROM users INNER JOIN customers INNER JOIN products WHERE customers.customers = 1 and users.users = 2 and `products`.`id` = 1 and products.name = 'me' ORDER BY customers.id DESC"; $string_1 = "SELECT users FROM users"; foreach ($Models as $alias => $table) { $string = preg_replace("/(\s|,)`?{$alias}`?/", "$1`{$table}`", $string); } echo $string;
Output for git.master, git.master_jit, rfc.property-hooks
SELECT `m_users` as Name,`m_users`.`family` AS Family, `m_products`.id AS PID, `m_customers`.`id` AD CID FROM `m_users` INNER JOIN `m_customers` INNER JOIN `m_products` WHERE `m_customers`.customers = 1 and `m_users`.users = 2 and `m_products`.`id` = 1 and `m_products`.name = 'me' ORDER BY `m_customers`.id DESC

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:
149.81 ms | 406 KiB | 5 Q