Zend Studio makes things very simple when it comes to debugging web applications that were developed in PHP. The following code sample include two files.

The first presents a simple form to the user that allows him to enter the width and the height of a specific rectangle.

<form method="get" action="index.php">
width: <input type="text" name="width">
<br>
height: <input type="text" name="height">
<br>
<input type="submit">
</form>

When pressing submit a request is sent to the second PHP document that calculates the area and the perimeter.

<?php
$width = $_GET['width'];
$height = $_GET['height'];
//$width = 7;
//$height = 9;
$area = $width * $height;
$perimeter = 2 * ($width+$height);
echo "<br>area=$area";
echo "<br>perimeter=$perimeter";
?>

The bar shown on the bottom of the web browser allows us to debug both the first page and the second one. The following video clip shows how to use this intutitive debugger.

You can find more code samples and video clips for learning PHP and for learning how to use the Zend Studio in my free online courses at http://abelski.lifemichael.com.

Leave a Reply

Your email address will not be published. Required fields are marked *