Custom Search

Sunday, June 20, 2010

Flow Control and Iteration

Flow Control and Iteration
Flow control and iteration are two very useful features of most programming languages. Without them all programs would have to be linear and if you wanted something to happen three times, you would have to code it three times.
Flow control means exactly what it sounds like it should, controlling the flow of something. When using flow control for programming, what you are doing is regulating the order in which the code is executed, how many times it is executed, and if it is executed at all Programmatic flow control can be broken into three primary categories.

Conditionals
Conditionals allow us to specify wether or not to run a selected piece of code based on some prior condition. It is the first topic we will cover. It is broken into two lectures, the first is an introduction to conditionals. The second is a discussion of some of the more advanced tools available in PHP for comparing things.Iteration
Our next topic is iteration. Iteration, also known as looping, us to specify that a piece of code be run multiple times. Depending on circumstances, that can be one or more or zero or more times.
Functions Our last primary flow control tool is functions. Functions allow us to create named blocks of code to be called by name elsewhere in the script. This allows us to run a piece of code multiple times from multiple places in the script. It is also the first step to writing good, modular code. This section contains both a brief introduction to functions and a more detailed look at advanced function topics in PHP

what is use php

  • php is a scripting language that is often embedded into html to add functions html alone can't do. php allows you to collect, process and utilize data to create a desired output. in short, it let's you interact with your pages.
    php is able to preform a number of tasks including printing data, making numeric calculations and making simple boolean choices. from this you can create more complex loops and functions to make your page generate more specialized data,

Database Access
One of set modules control database access. Using PHP with MySQL has become common enough that the MySQL interface is now part of core PHP instead of a plug-in module. Most other databases have modules that can be included in a PHP build to allow access. PHP can access most any SQL or ODBC database. It can both read and write information in the database.

This opens up the door for a whole variety of online business applications that require data storage on the server. Because of this, PHP is becoming an increasingly popular tool for e-commerce.

File Access

PHP can read and write files. It can also do basic file and directory maintenance. Because of this, you can use it to do such things as edit documents remotely. It can also be used to search flat file collections for the existence of a given file or for the existence of information stored in files and return the results. Information does not need to be coded into a database just to be accessible.

It can also take content and use it to generate files in various formats, including HTML and PDF. It is an incrasingly popular tool for processing XML for HTTP distribution. It can also take data and use it to generate e-mail, which is can send out through most any standard mail protocol.

Its ability to work across multiple data sources and return multiple content types makes it an ideal tool for things like search engines and message boards.

Application Control

PHP started as an application control language. Specifically, it was designed to handle access logging for HTTP servers. This ability has expanded greatly and now PHP can even be used as a scripting language in such applications as Microsoft Word and Excel.

Graphics
PHP can not only manage text content, it can also manage graphic content. It can be used to create graphs and charts. It can be used to generate GIF and PNG images on the fly, allowing you, for instance, to have a button template that has the text added to it dynamically before being sent to the client. This means you don't need a new image for each button, just one image that has the text added as needed for each individual button.

Extensible
PHP is extensible. It is written in C and the underlying source can be expanded on with new modules written in the same. It is also open source, so engaging in such expansion is permitted and encouraged

What Can PHP Do?

PHP is a server-side scripting language whose primary purpose is to generate HTML content. Its creator, Rasmus Lerdorf defines it as "a cross-platform, HTML-embedded, server-side web scripting languageWith the current direction of the Web, it is easily being adapted to writing out all forms of XML content as well. The most recent version of PHP

It was originally developed as a set of server-side modules to perform some specific Web-server tasks on small, Unix-based Web servers. Since then PHP has grown beyond the work of one man writing some tools for his own use and into one of the most popular server-side scripting languages in the Web.

Three thing make PHP popular. The first is that it is easy: easy to implement, easy to learn, and easy to use. The second is that it is free. The third is that it runs on almost any Web server on almost any platform currently available.

PHP is both a scripting language and a collection of tools for performing various server-side functions in an HTTP, or Web, server. Since it is written as a collection of C-modules, it can go beyond server-side scripting and can also be used to execute scripts from the command line and for developing client-side GUI applications that can operate on most any platform.
The core features of PHP are built around the ability to process strings and arrays, as well as to work as an object-oriented programming language. Beyond this most of PHP is a collection of modules that can be added in on the server as needed to perform a large variety of specific tasks. In other words, it is a highly customizable application, and you can keept it small by only installing as much as you need to perform required tasks