3v4l.org

run code in 500+ PHP versions simultaneously
<?php $before = 'abca'; $after = preg_replace( '/a/', 'a', $before, -1, $count ); if ( $after === $before ) { echo "NO REPLACEMENTS" . PHP_EOL; } echo $count . " REPLACEMENTS";
Output for 8.1.34, 8.2.30 - 8.2.32, 8.3.5 - 8.3.33, 8.4.9 - 8.4.24, 8.5.0 - 8.5.9
NO REPLACEMENTS 2 REPLACEMENTS

preferences:
52.61 ms | 606 KiB | 4 Q