Introduction to PHP Flashcards
Acronym for PHP
PHP: Hypertext Preprocessor
- A server-side programming language – it runs on a web server.
- A widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
PHP
2 URLS for viewing in the address bar of your web browser:
- localhost/folder_name
- 127.0.0.1/folder_name
Without specifying the file to open _________ is the default webpage that will be displayed.
index.php
Three different pairs of opening and closing tags
- Default syntax
- Short open tags
- Omit the PHP closing tag at the end of the file.
Short style tags are only available when enabled in _ configuration on file servers.
php.ini
True or False
In PHP the user defined functions, classes, core language keywords (e.g. if, else, while, echo etc.) are case insensitive.
True
True or False
In terms of VARIABLES, PHP is case-insensitive
False
In terms of VARIABLES it is case-sensitive
A _ in PHP code is a line that is not executed as a part of the program. Its only purpose is to be read by someone who is looking at the code.
comment
PHP variable names must begin with a _ , and cannot contain spaces.
dollar ($) sign
True or False
Variables in PHP don’t need data type.
True
are used to perform different actions based on different conditions
Conditional statements
executes some code if one condition is true.
if statement
executes some code if a condition is true and another code if that condition is false.
if…else statement
executes different codes for more than two conditions.
if…else if…else statement
used to perform different actions based on different conditions.
switch statement
Loops through a block of code a specified number of times.
for loop
Loops through a block of code as long as the specified condition is true.
while loop
Loops through a block of code once, and then repeats the loop as long as the specified condition is true. This loop will always execute the block of code once.
do…while loop
Loops through a block of code for each element in an array.
foreach loop