3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getHookPattern($hook) { return preg_replace( '/^(?<prefix>[a-z0-9_]+_)?[A-Z][A-Z0-9_]+(?<suffix>_[a-z0-9]+)?$/', '${1}[a-z0-9_]+${2}', $hook ); } $hooks = [ 'form_alter', 'form_FORM_ID_alter', 'entity_query_tag__ENTITY_TYPE__TAG_alter', 'ENTITY_TYPE_insert', 'preprocess_BLOCK', 'foo_BAR0_baz', 'foo_BAR_0baz', 'foo_BAR_0_baz', ]; foreach ($hooks as $hook) { print getHookPattern($hook) . "\n"; }
Output for git.master, git.master_jit
form_alter form_[a-z0-9_]+_alter entity_query_tag__[a-z0-9_]+_alter [a-z0-9_]+_insert preprocess_[a-z0-9_]+ foo_[a-z0-9_]+_baz foo_[a-z0-9_]+_0baz foo_[a-z0-9_]+_baz

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:
30.42 ms | 405 KiB | 5 Q