You are currently on IBM Systems Media’s archival website. Click here to view our new website.


Beginning PHP Programming

In part one we covered setting up PHP and running it on your iSeries server. Here, I offer coding tips and explore some of the possibilities that PHP can potentially unlock.


Even if you're new to PHP, chances are you'll find it familiar: The scripting languages syntax is similar to C++, meaning that C++ as well as C, Java* and Perl users should find PHP easy to pick up.

Conditionals and Loops
Part one introduced the echo function and the assignment (=) operator. However, there's little you can do with these on their own. That's where conditionals and loops come in.

This example introduces several new concepts:

  if (isset($_GET['printme'])) {
        echo ("

  } else {
        for ($i = 0; $i < 10; $i++) {
                echo ($i . "



The first line contains this bit of code: . Lets break this down. While last month's samples incorporated ". Whatever is between these tags-""-is what's printed to the Web page.

Another new concept is "$_GET['title']," which is an array containing a list of variables passed to the Web page through the GET method of HTTP. Suppose you save this code in the IFS under your Web server root directory as webpage.php and that it's accessible via this URL:



David Stockton is a programmer with J.D. Edwards World Solutions Company. He can be reached at his Web site



2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

A PPP Monitor Utility

Here's a program developed to programmatically obtain the status of a PPP connection

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters