Login
Password

Forgot your password?

How to Learn PHP for FORTRAN Programmers

By Edited Jun 24, 2015 0 0

PHP introduction for FORTRAN programmers

A modern language to consider

FORTRAN was the earliest third generation programming language used by computers. It rendered machine and assembly languages largely obsolete due to the great advancement in productivity provided by its use. FORTRAN programmers had long careers using that language for many purposes. Originally for numeric work, FORTRAN was used for a wide range of other applications including financial systems, games, reporting and many, many more.

PHP is one of the newer, modern programming languages that is widely in use on the Internet. It is quite unlike FORTRAN, for better or for worse. Since it is in widespread use, it is a good option for those FORTRAN programmers who want to learn a modern development tool. The basics of the language are easy to understand. As skill is gained, the programmer can explore the more complicated features. PHP is an unusual language, as explained later. The meaning of "PHP" is itself unusual. It originally stood for "Personal Home Page" but has been changed to "PHP Hypertext Processor". This essentially creates an unwanted recursive situation for the definition. (Recursion: see "Recursion".)

This article assumes that you are a FORTRAN programmer or that you know another third generation language such as PASCAL, C, COBOL, etc. There will be no elementary explanation of variables, data or program logic except where such explanations will assist in the learning of PHP.

PHP similarities with FORTRAM

PHP and FORTRAN do share some similarities. Both have variables and standard assignments. This code fragment should be understandable to any FORTRAN programmer:

$tax_rate = 0.10;
$price = 100;
$tax_due = $price * $tax_rate;

Like standard FORTRAN, the PHP variables are defined when they are first referenced. Semicolon characters are required end the end of PHP statements. This is similar to code writing conventions found in languages like C or PASCAL. Variables cannot be used before they are initialized. There is no data type associated with the variable name. Consider the following code fragment:

$i = 100.29;

In standard FORTRAN, variables starting with the character "i" are integer types. This is not true in PHP. Any variable is typed according to the initial assignment.

PHP program structure

Consider the use of modules

Many FORTRAN programs are written as large blocks of code statements in a single file. These are compiled into executable code to be deployed. Even those programs that utilize multiple program files are often bound together logically as a single large body of FORTRAN statements. They may use calls to library modules to perform certain functions. In the end, the executable contains all of the code necessary to run the application. This may differ depending on the target deployment system.

PHP can be written as large single files full of code but it often makes sense to separate the code into source code modules. This concept can confuse experienced FORTRAN programs. Refer to the diagram.

This module layout shows that the PHP program is comprised of a menu block and other modules that are used in the application. Each module is specific to a single area of the application. The menu is common to all areas so it is in its own file. The Student module contains application code for the handling of students. The School module is similar. The modules are defined for more detailed areas of the application. Student_Add, Student_Delete and Student_Report each contain PHP code that implements the actions needed to accomplish the functions of the module title.

Advertisement
Advertisement

Comments

Add a new comment - No HTML
You must be logged in and verified to post a comment. Please log in or sign up to comment.

Explore InfoBarrel

Auto Business & Money Entertainment Environment Health History Home & Garden InfoBarrel University Lifestyle Sports Technology Travel & Places
© Copyright 2008 - 2016 by Hinzie Media Inc. Terms of Service Privacy Policy XML Sitemap

Follow IB Technology