I need to place long, multiline text into variable. But with 'comments', small portion of the text the shouldn't be in the result.
Pseudocode:
$var = <<<MULTILINETEXT
Some text {//Excluded from output}
Some text2 {//Excluded from output}
MULTILINETEXT;
$var after this:
Some text
Some text2
Any ideas?
Here use a reg expression to ignore the string that enclosed in between the { and }.
$var = <<<MULTILINETEXT
Some text {//Excluded from output}
Some text2 {//Excluded from output}
MULTILINETEXT;
$var = preg_replace("/\{[^}]+\}/", "", $var);
print_r($var);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.