PHP control structures

Lecture




PHP control structures

" General information

PHP conditional statements:

" if
" else
" elseif

Cycles:

" while
" do-while
" for
" foreach
" break
" continue

Selection designs:

" switch-case

Ad constructions:

" declare

Return value constructs:

" return

Inclusion Constructions:

" require
" include
" require_once
" include_once

Additionally:

" Alternative PHP syntax

PHP control structures

Any PHP script is formed from a number constructions . Constructions can be operators, functions, cycles, conditional operators, even constructions that do nothing (empty constructions). Constructions usually end with a semicolon. In addition, structures can be grouped into a group, forming a group of structures with curved braces {...} . A group of structures is also a separate structure. PHP language constructs are similar to those in the C language.

In PHP, there are six basic groups of control constructs.

created: 2016-01-25
updated: 2021-03-13
132440



Rating 9 of 10. count vote: 2
Are you satisfied?:



Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Running server side scripts using PHP as an example (LAMP)

Terms: Running server side scripts using PHP as an example (LAMP)