3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ '$hey()', '$hey->hi()', '$hey(\'hi\')', '$hey moretext()' ]; foreach ($strings as $string) { if (preg_match('~^\$\w+\([^)]*\)$~', $string)) { echo $string . "\n"; } }
based on 7cXYP
Output for 7.3.0 - 7.3.27, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
$hey() $hey('hi')