- var_dump: documentation ( source)
- version_compare: documentation ( source)
- preg_match_all: documentation ( source)
<?php
if (version_compare(PHP_VERSION, '5.4.0') >= 0){
preg_match_all('/(?:\e\[(.*?)m|(\x08))/',"foob\e[31;41ma\e[0mr\x08\x08\x08 ", $matches, PREG_OFFSET_CAPTURE);
} else {
preg_match_all('/(?:\\\e\[(.*?)m|(\x08))/','foob\e[31;41ma\e[0mr\x08\x08\x08 ', $matches, PREG_OFFSET_CAPTURE);
}
var_dump($matches);