3v4l.org

run code in 300+ PHP versions simultaneously
<?php $params = [':foo' => null]; $sql = 'select * from test where foo = :foo'; $sql = preg_replace_callback( '/(?<!\b)(?<![:\\\]):(#?[a-zA-Z0-9_-]+)/', function ($match) use ($params) { return $params[$match[1]]; }, $sql ); var_dump($sql);

preferences:
23.41 ms | 405 KiB | 5 Q