Hi guys,
Would appreciate some help with a problem when running eval() on a function that should return true or false.
From php.net:
Quoteeval() returns NULL unless return is called in the evaluated code, in which case the value passed to return is returned.
Not sure if I'm missing something here but the following code illustrates that the function returns true/false as expected when run directly. However, the same function run using eval() never returns true:
Code: <?php
// Function to test what eval() returns...
function test()
{
$test = rand(1, 3);
return ($test === 1) ? TRUE : FALSE;
}
$eval = "test();";
$test = eval($eval); # expect this should set $test to TRUE for 1 in 3 attempts
echo ($test) ? 'eval returned true' : 'eval returned FALSE or NULL <br />';
// Now retest the function by calling it directly, not through eval...
$test2 = test();
echo ($test2) ? 'test returned TRUE' : 'test returned FALSE or NULL <br />'; # this behaves as expected...
?>
Hopefully it's something ridiculously obvious to someone out there...
Echoing If Function?
A script I am using has If statements in the comments form to basically tell the form what to do. Currently the form works by opening in a pop up for those who want to read/write comments. I'm
i have no idea why this isn't working
Code: <?phpsession_start();include("connect.php");error_reporting(E_ALL);ini_set('display_errors', '1'); $username = "Master";$password = "pword";$host =
Basic Forum Tutorial
Hi, I'm new to PHP. I want to build a basic forum for my site using PHP and MySQL. I've searched the 'net, but every tutorial I found the writer seems to get 'too technical' after a few steps. I
. and .. appearing instead of pictures
First of all, thanks very much for providing this forum. It is very much appreciated!My son-in-law created a php script for my website about 10 years ago to show pictures like a manual slideshow, and
EXplanation help
Hey all,I am still fairly new to PHP programming and I am trying to put together a page where you select search terms from a drop down menu and it keeps the menu at your search choice in the menu
"GROUP BY" in arrays
Well i'm looking to do something i usually could do easily using COUNT and GROUP BY if it was a sql query... But this time i'm working with an array...so i have an array that looks like thisCode:
how to transport the Query and insfoset
Hi
Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The user has JRE 1.4.2_13 installed. When he clicks the print button, IE freezes, and nothing prints.
strptime() equivalent for php4 ?!
Greetings!this is my first post, thank you in advance for your replies. Well, the title says it all, is there an equivalent of the function strptime() for php4 ? I want to parse a timestamp like this
Simple program to copy files between two computers over the web
I use logmein free and often need to move files between my two computers. Generally, I move the file to my server, then download it, but it takes longer because of the intermediate step.Is there a