Page 1 of 1
register_globals and performance
Posted: Wed Aug 13, 2003 8:21 am
by scorphus
Hi,
If "register_globals" is enabled in php.ini, PHP have to make a copy for global var. Beyond unsafe it affects the performance of the PHP. But how much performance do one lose setting it this way?
Thanks for your time.
Regards,
Scorphus.
Posted: Wed Aug 13, 2003 8:58 am
by JAM
Not sure, but I hardly think that the performance difference between the two would be drastic...
You could test it by:
Code: Select all
<?php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
?>
<form methof="post">
<input type="submit">
<?php
for ($i=1;$i<2000;$i++) {
echo '<input type="text" name="somename[]" value="Current val: '.$i.'">';
}
?>
</form>
<?php
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Took $time seconds";
?>
...or something after rewriting it, and then try submitting it with and withought register_globals...
Posted: Wed Aug 13, 2003 9:29 am
by McGruff
Nothing you'd notice.
In any case, reg globs should always be off for security reasons - if you have the choice.