Thursday, January 11, 2018

Programming fundamental concept of PHP

Programing fundamental concept 

PHP fundamental

There are several things you'll need to understand about programming in order to get the greatest benefit from this book. Programming languages differ greatly, but they all share certain traits, and those characteristics are the basis for knowing how to create a program. 

       We'll find many of the terms described  in the glossary; however, a good grasp of what they mean now will make the following  much easier to follow. 

The some programmer are name   mansion here:-

•   constructs
•   statement
•    function
•    Constant and variables


 The term “construct”as a noun refers to any assembly of parts of a language that matches the rules of syntax of that language. In English, for instance, the word “a”is a construct. We can use it as-is, because it's a recognizable article of speech. 

     Constructs in programming languages are basically the same. They may be used independently of other programming elements and are sometimes incorrectly referred to as “commands.”It's important to know about constructs because they sometimes don't follow the same rules as other program elements. 

The “echo”construct is an example we'll use often in our code examples. It causes whatever follows it to be output immediately, normally to the computer screen. 

Statements :-

A statement is the smallest part of a programming language. It's comparable to a sentence in a spoken language, in that it needs to meet certain criteria dictated by the programming language. Statements may identify elements of a program or contain instructions for the computer. A statement may be considered a line of code; however, it's important to realize that PHP statements may span more than one line on a page. By the same token, multiple PHP statements can be written on the same line of a page. 

Functions :-

A function in a program is a sequence of statements grouped and named with an identifier so that it can be executed from anywhere within the program. By creating functions, a programmer provides an easy way to perform operations without the need to repeat the statements. 

            Functions may require the input of values when executed. For instance, a program may contain a function that performs math operations on values that must be entered each time the function is executed or “called.”In other cases, these values may be parameters limiting the operations of the function. This input is often referred to as “passing”the values. In PHP, values are passed within parentheses immediately following the name of the function. 

     Most programming languages, including PHP, include a number of  function are name:-

•    predefined functions and 
•    allow for user-defined functions 

One of the ways we optimize computer programs is by storing values in computer memory for use in various routines within the programs. By storing a value as a block of data, we can use it repeatedly in a program without the need to find its value each time. These “reusable”values are normally stored in one of two ways, as a constant or as a variable

       As the terms imply, the main difference between the two is whether the value of the data can be changed within the program. As you've probably guessed, the value of constants cannot be changed, while variables can be acted on by elements of the program to change the data. Constants are most often used for fixed values that might need to be changed periodically because of some external influence, such as a tax rate. They may also be used to store long strings of text or complex numbers in a way that makes them easier to insert into the program code.

PHP includes several predefined constants, most of which are used for configuring core installations and troubleshooting programming problems. 


When a variable is stored, extra space is allocated in computer memory to allow for changes. Since constants can't be changed by the program, only the amount of memory necessary for the original data is used. The data for a constant will also be optimized on the computer for faster access. This saves resources and computing time, also known as “overhead,”which is the chief reason to use constants when feasible. 

     PHP constants are created and assigned a value by means of a predefined function:

Define Constant names are case-sensitive. In other words, “CONSTANT,”“Constant”and “constant”would describe three separate names. 

Note: -

While there is no rule governing the case used for constant names, the accepted standard is to use all uppercase letters in a constant name, as “CONSTANT.”This makes the element clearly identifiable. 

PHP Variables are created and assigned their initial values with a statement called a declaration. Variable names are also case-sensitive. While any combination of letter case can be used in a variable name, it's good practice to be consistent throughout your programs. All variable names must begin with the “$”character. 

Each programming language has its own set of rules for declaring variables and constants, as well as the types of data allowed. In many programming languages, the data type must also be declared. PHP, however, automatically assigns a type to variable and constant data. Read more 

Note: -

Names for constants, variables, functions and other elements are considered “labels.”Programming languages have rules that determine how valid labels are created. In PHP, labels may contain:


Please comment and follow this site blog inbox