3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/\bsite_[a-zA-Z0-9]*/'; $query = 'SELECT * FROM site_customers LEFT JOIN site_products'; preg_match_all($re, $query, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches); // Replace old tables with new ones $old = [ $matches[0][0], // First table name $matches[1][0], // Second table name ]; $new = [ $matches[0][0] . '_02', // Append _02 'new_' . $matches[1][0], // Prepand new_ ]; $query = str_replace($old, $new, $query); // Print the new query echo $query;
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(1) { [0]=> string(14) "site_customers" } [1]=> array(1) { [0]=> string(13) "site_products" } } SELECT * FROM site_customers_02 LEFT JOIN new_site_products

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