3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(firstWordPosition('Will company any do any job, (are there any)?', 'any')); var_dump(firstWordPosition('Will *any* company do *any* job, (are there any)?', 'any')); function firstWordPosition($str, $word) { // There are others, maybe also pass this in or array_merge() for more control. $nonchars = ["'",'"','.',',','!','?','(',')','^','$','#','\n','\r\n','\t',]; // You could also do a strpos() with an if and another argument passed in. // Note that we're padding the $str to with spaces to match begin/end. $pos = stripos(str_replace($nonchars, ' ', " $str "), " $word "); // Have to account for the for-space on " $str ". return $pos ? $pos - 1: false; }
Output for git.master, git.master_jit, rfc.property-hooks
int(12) int(43)

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.28 ms | 405 KiB | 5 Q