string - How to enclose text within [cdata]...[!cdata] using PHP? -


i'm getting text in variable follows:

$text = 'this code snippet'; 

now want enclose above text within [cdata]...[!cdata].

the output of echo $text should below:

[cdata]this code snippet[!cdata] 

how should this?

thanks.

try

$text = 'this code snippet'; $text = '[cdata]'.$text.'[!cdata]'; echo $text; 

Comments

Popular posts from this blog

php - Hide output during test execution -

javascript - Migrate custom AngularJS filter from 1.2.28 to 1.4.x -

Update Magento products with multiple images -