WordPress.org

Support

Support » Plugins and Hacks » PHP not giving correct results

PHP not giving correct results

  • CharlesJDillon

    @charlesjdillon

    Hi, I am trying to get Exec-PHP to work, in testing I tried just a test global code that you can use to make sure your php is working.

    <?php
    $a = 1;
    $b = 2;
    
    function Sum()
    {
        $GLOBALS['b'] = $GLOBALS['a'] + $GLOBALS['b'];
    } 
    
    Sum();
    echo $b;
    ?>

    Everywhere else the answer is 3 of course, but for some reason when I run it through on my WordPress site using Exec-PHP it is giving me the answer of 2.

    Eventually I would like to run table data from a MySQL but if it is not even giving me the right answer for a generic global…I am not sure where the problem is.

    http://wordpress.org/plugins/exec-php/

  • The topic ‘PHP not giving correct results’ is closed to new replies.