3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keywords = ['Paso', 'Robles']; $columns = ['ID', 'StorageArea', 'Size', 'Winery', 'Brand', 'Appellation', 'ReleaseYear', 'Varietal', 'Status', 'CountryName']; $where = 'WHERE ' . implode("\nAND ", array_map(function ($keyword) use ($columns) { $keyword = str_replace("'", "''", $keyword); return "\n(" . implode(' OR ', array_map(function ($column) use ($keyword) { return "\n`$column` LIKE '%$keyword%'"; }, array_filter($columns, function ($column) { return $column !== 'ID'; }))) . "\n)"; }, $keywords)); echo $where;
Output for git.master, git.master_jit, rfc.property-hooks
WHERE ( `StorageArea` LIKE '%Paso%' OR `Size` LIKE '%Paso%' OR `Winery` LIKE '%Paso%' OR `Brand` LIKE '%Paso%' OR `Appellation` LIKE '%Paso%' OR `ReleaseYear` LIKE '%Paso%' OR `Varietal` LIKE '%Paso%' OR `Status` LIKE '%Paso%' OR `CountryName` LIKE '%Paso%' ) AND ( `StorageArea` LIKE '%Robles%' OR `Size` LIKE '%Robles%' OR `Winery` LIKE '%Robles%' OR `Brand` LIKE '%Robles%' OR `Appellation` LIKE '%Robles%' OR `ReleaseYear` LIKE '%Robles%' OR `Varietal` LIKE '%Robles%' OR `Status` LIKE '%Robles%' OR `CountryName` LIKE '%Robles%' )

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:
29.41 ms | 402 KiB | 8 Q