$x="include('home/adulu/public_html/123.php');"; echo "$x";(i'd like it print 123.php scripts) but it just print text ->"include('home/adulu/public_html/123.php');" please help. thanks
why of course.. it should print what is in your variable $x which is the string "include('home/adulu/public_html/123.php');" set your $x to '123.php' and you'll get what you want... what really are you trying to achieve here anyway?
example:123.php's content is <?php $y=(1+2); echo "$y"; ?> I hope i can $x="include('home/adulu/public_html/123.php');"; echo "$x"; rusult print is 3 but actually is print include('home/adulu/public_html/123.php'); this is not my wish.
Yes.. What do you want to achieve here...? If you want to execute PHP code inside a string, use "eval" function .. eval($x);
my achieve because i'd like to determine include or not include $a=yes; if($a=="yes") { $x="include('home/adulu/public_html/123.php');";(this is wrong code that is asume) } else { $x="nothing"; } ------------content------i am only can modify above code area echo "$x"; (I hope this [echo "$x";] can include 123.php file)
<?php ob_start(); include('fileYouWantToStore.php'); $a = ob_get_contents(); ob_end_clean(); echo $a; PHP:
This is less code to do what you wanted: ( file_get_Contents returns as a string, returns as FALSE on failure ) <?php $file = file_get_contents('filepath/file.php'); echo $file; PHP: