<?php
$value = "<p> Lorem ipsum dolor [State] sit amet, consectetur [City] adipisicing [TopJob7] elit, sed do eiusmod [JobType]</p>";
$tagsReplace = preg_split('/(\[[^]]+\])/', $value, -1, PREG_SPLIT_DELIM_CAPTURE);
print_r($tagsReplace);
- Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- Array
(
[0] => <p> Lorem ipsum dolor
[1] => [State]
[2] => sit amet, consectetur
[3] => [City]
[4] => adipisicing
[5] => [TopJob7]
[6] => elit, sed do eiusmod
[7] => [JobType]
[8] => </p>
)
preferences:
104.86 ms | 408 KiB | 5 Q