Dissecting/Understanding the first program

The first post had you making a program that was equivalent to the “Hello World” program used for teaching basics of a programming language and here’s how it worked. When the script was requested by opening the web page, Apache intercepted the request and passed it onto PHP which parsed the script looking for the code in between the terminators and then doing the requested operation which was to display the text contained within the echo command. This result was given back to the server then again to the client. The output contained a valid HTML so the browser was able to understand it and execute the requested operation.

Array Combine

This function combines two arrays where the first array is treated as the key and the second array as the contents of the said table. The syntax goes like this : array_combine(array1,array2), wherein the array1 is the table which contains the keys values, and the array2 is the contents. It should be noted that these two tables or array�s should have equal amounts of contents for it would become problematic if there was an error in the combination process. An example of the process is shown below:

$a1=array('a','b','c','d')
$a2=array2("Mouse","Rat","Rodent","Mice")
print_r(array_combine($a1,$a2))
?>

The output of which would give us a single table :

Array ( [a] => Mouse [b] => Rat [c] => Rodent [d] => Mice )

The function combined the two tables giving a single table that combines the keys and the contents. More in-depth discussion on the different array functions which in future posts would be the backbone of applications we will be building.

PHP with Dreamweaver

Dreamweaver 8

Once you open your PHP application such as Dreamweaver, chances are you will be overwhelmed on what you can do with it. In the early stages, you will find yourself being taken aback for the reason that you will see a lot of features such as command lines and scripts that you can use.

Dreamweaver does allow you advanced programming with PHP. However, do remember that you have to start from the bottom. Learning the basics first and slowly integrating them as you go along the way will be the best way to approach it. In short, don’t let your enthusiasm for the software get the best of you. Take it one step at a time.

Fooling Around with PHP

PHP Programming

Although some people may not know it, you can fool around with PHP programming and come up with surprisingly unique yet attractive sites. This includes placing images along with some new scripts which may turn out to be to your advantage in the end as far as presentation is concerned.

So as far as PHP programming to being too technical, think again. You won’t know what you can do until you are upfront with the application itself. Once you do get upfront with it, don’t be surprised if you suddenly find yourself wanting to learn more about this line of programming. It will surely be an interesting journey into programming and development on your end.

PHP’S POPULARITY

smgutmans.jpg

PHP is considered to be one of the most popular server-side scripting systems on the web. And because of PHP’s popularity, a new generation of programmers who are familiar with PHP alone makes it possible to open a “command line interface” for PHP. Along with GUI functions support (Gtk or ncurses support), CLI or “command line interface” is a process of interacting with a computer by providing lines of text commands in written structure either from a keyboard input or from a script. This whole process of command line interface is considered to be a major step for PHP as it stands for its implementation as a genuine programming language.

PHP: server-side scripting

cs.jpg

PHP’s principal focus is server-side scripting which is a web server technology in that involves the process of running a script directly on the web server to create dynamic HTML pages thus fulfilling the user’s request. PHP is originally intended to generate dynamic web pages and its server-side scripting function is the same with other server-side scripting languages that offer dynamic content from a web server to a client, such as ASP.NET system of Microsoft, Sun Microsystems’s JavaServer Pages and mod perl. PHP attracted development of various frameworks (code library made for helping in software development) as well that give building blocks and a design structure to promote rapid application development (RAD).

PHP Debugging

There are five different categories of an error message that the PHP interpreter may fall into:
PARSE ERROR: usually problems with the syntax of the program. This includes forgetting to place a semi-colon by the end of a statement. The interpreter will stop running when it encounters a parse error.
FATAL ERROR: this means a severe problem with the program content. Like in a parse error, the interpreter will also stop running when encountering a fatal error.
WARNING: an advisory that the interpreter gives whenever there is something fishy in your program. But unlike the first two errors, the interpreter will still keep on running.
NOTICE: this is a tip from the PHP interpreter.

Variables Used

Variables are used to temporarily keep or store something that you want to save. When the time comes that you will be needing them, recall the variables and they will give you the information that you stored for you to change, delete or edit it.

$message = "Hello Haroon";
echo "PHP Tutorial";
echo $message;
?>

‘Hello Haroon’ is the information that you want to save temporarily, while the message ‘PHP Tutorial’ is displayed.

The output of the program will be: PHP TutorialHello Haroon

In PHP, $ is used to define a variable. PHP, unlike C or Java, is a loose-typing scripting language.

Bugs and How to Deal With Them

phpbugsiteNo bug spray can get rid of the many programming bugs that are detected by the parser as you compile the program to come up with the final product. As any programmer knows, program bugs are as sure as the existence of and energy drink by their side, and though most of them may be the result of simple typo’s and other naming problems one can be assured of an unusual one that defies all your efforts and phone calls to buddies. What do you do? Ask the community of course, through the PHP Bugs site where they are compiled as reference for all who use PHP. Read the rest of this entry »

PHP TestFest 2009 Almost Here

testfestPHP developers and industry leaders are holding this year’s Testfest 2009 in a few months to get people all over the globe to test and review the current RC for approval and review pending full release. Such public or community testing is standard of the many open-source developers who help each other to test out new features and past problems if they were addressed or not. Many of the detected errors would be addressed in the subsequent Full Release. The open-sourced community is made up of leading programmers, developer groups and even companies, all of which work together during testfest. Read the rest of this entry »