Jump to content

how i assign php code to variable?.


nivas_kumar

Recommended Posts

The easiest way to do something like this, is to import the text into the script. Otherwise, you'll just have to manually escape anything that needs escaping.

 

Luckily for you though, in this case, you can simply use single quotes and the string you have there will be saved to the variable just fine.

 

Just in case you're planning on using that string in an eval(), remember the wise words of the creator of PHP Rasmus Leardorf:

 

"If the answer to your question is using eval(), then you almost certainly did not ask the right question.";

Error is:

Parse error: syntax error, unexpected '[', expecting ']' in C:\xampp\htdocs\zpro.php on line 3

 

And Code is:

File Name:zpro.php

 

echo $stringdata="<?php

$str = &$str[$blocks[$i]];

$str = &$str[sizeof($str) - 1];

 

?>";

 

after $stringdata, It will be stored in new file.

Did you try using single quotes?

 

after $stringdata, It will be stored in new file.

 

If that was a response to --

import the text into the script

 

I think you missed my point there. What I said is about where you get the string from, you're talking about where it goes when you're done.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.