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

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -

Qt4: how to send QString inside a struct via QSharedMemory -