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...
Parse Error Help
Hello, I got the parse error "Parse error: syntax error, unexpected ',' in register.php on line 21Heres the code:Code: <body
Operator precedence assistance.
I did a quick Google search and couldn't quite find the answer I wanted in terms I could understand, so, if I may, I'd like to ask quite a specific question.I'm creating a contact form, and I need to
phpmailer class & pop.gmail.com?
Code: <?php $mail->IsSMTP();$mail->Host = "pop.gmail.com";$mail->Port = 995;$mail->SMTPAuth = true;$mail->Username =
PHP Thumbnail Creation
Ok so i use this function to create thumbnails:Code: [Select]function createthumb($name,$filename,$new_w,$new_h){ $system=explode('.',$name); $src_img=imagecreatefrompng($name);
Default TimeZone
The server I'm working with is hosted in America so all times inserted into the database are coming out 5 hours differen't to what I want them to. I attempted placing the following in my Header
Blogging s/w
heya frndz!!! i want to start a blog.... m looking for a s/w like oscommerce which is thr for e-comm websites... so can u please suggest me some s/w through which i can set up the blog... thnx in
mySQL and PHP search
Hello,I am trying to code a project and ran into a brick wall with one of my pages. I am pretty new at php/mySQL and can not figure this out. Now I know that you are not going to sit there and type my
Phase Error I can't seem to find :(`
Hey guys, I can seem to find my phase error on this. I am getting this error[error]Parse error: syntax error, unexpected $end in /home/klrbal/public_html/Mafia-test/tempfam.php on line
Remove letter from numeric textbox
I have a textbox that will search the employee database by entering in the employee ID and it will return the result on the same page.QueryCode: if(isset($_GET['findagentid']) &&
losing session vars when arriving from an email link
Hi,I've got a confirmation script made that sends an email with a link for a user to confirm their email. This all works pretty good with the exception of not being able to direct them to where they