Asked  7 Months ago    Answers:  4   Viewed   28 times

If I have a function:

function this($a){
   return $a;

If I wanted to redefine the function, would it be as simple as rewriting it?

function this($a, $b){  //New this function
   return $a * $b;



Nope, that throws an error:

Fatal error: Cannot redeclare foo()

The runkit provides options, including runkit_function_rename() and runkit_function_redefine().

Wednesday, March 31, 2021
answered 7 Months ago
function round_up($value, $precision=0) {
    $power = pow(10,$precision);
    return ceil($value*$power)/$power;
function round_down($value, $precision=0) {
    $power = pow(10,$precision);
    return floor($value*$power)/$power;
Saturday, May 29, 2021
answered 5 Months ago

While @Luceos answer is technically correct (the best kind of correct), it does not answer the question you asked, namely is doing this better, or do includes happen regardless of function calls?

I tested this in the most basic way (OP, why didn't you?):

echo "Testing...";

function doThing() {
    include nonExistantFile.php;
echo "Done testing.";


if I call doThing(); I get a file not found warning.

If I comment out doThing();... there is no error! So you can save file load time by doing this.

Thursday, August 5, 2021
answered 3 Months ago

add these code into the top of your script

ini_set('magic_quotes_runtime', 0);
Wednesday, August 18, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :