3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $content = <<< TXT Y-3.165 X-25.221 M8 Z32.054 Z26.57 F500 Y160.8 X123 X245 X-20.254 TXT; $content = str_replace('X-', 'X+', $content); $content = preg_replace('/X(\d)/', 'X-$1', $content); $content = str_replace('X+', 'X', $content); echo $content;
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Y-3.165 X25.221 M8 Z32.054 Z26.57 F500 Y160.8 X-123 X-245 X20.254