O'Reilly logo

PHP Application Development with NetBeans Beginner's Guide by M A Hossain Tonu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — running a debugging session

This section illustrates standard debugging sessions, and we will create a sample project to practice debugging on it:

  1. Create a NetBeans PHP project. For our example, we name it chapter4.
  2. Type the following code in the index.php file:
    <?php
    $fruits = array("Apple", "Banana", "Berry", "Watermelon");
    $myfruit = "";
    fruit_picker(); //first time call
    echo "My fruit is : " . $myfruit . "<br />\n";
    fruit_picker(); //second time call
    echo "My fruit is now: " . $myfruit . "<br />\n";
    fruit_picker(); //third time call
    echo "My fruit is finally: " . $myfruit . "<br />\n";
    function fruit_picker () {
    Global $myfruit, $fruits;
    $myfruit = $fruits[rand(0, 3)];
    }
    ?>
    

    The previous code contains:

    • A $fruits array containing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required