<?php
$string = 'Inicio da string: <?php echo "Hello World!"; ?> Obrigado!';
$splitedString = token_get_all(
code: $string,
);
print_r($splitedString);
$sanizedArray = [
[
'string' => 'Inicio da string:',
'type' => 'text',
],
[
'string' => '<?php echo "Hello World!"; ?>',
'type' => 'code',
],
[
'string' => 'Obrigado!',
'type' => 'text',
],
];
preferences:
28.26 ms | 402 KiB | 5 Q