PHP Basics and Syntax Flashcards
3 Types of arrays in PHP
- Numeric/Indexed Arrays
- Associative Arrays
- Multidimensional Arrays
An array with a numeric index. Values are stored and accessed in linear fashion.
Numeric/Indexed Array
An array with Strings as index. This stores element values in association with key values rather than in a strict linear index order.
Associative array
An array containing one or more arrays and values are accessed using multiple indices.
Multi-dimensional Array
It is used to reverse a string. It is one of the most basic string operations which are used by programmers and developers.
strrev()
String function that is used to compare two strings from each other.
strcmp()
It is used to find the length of string or returns the length of a string including all the whitespaces and special character.
strlen()
It is used to strip whitespace from the beginning and end of a string or both side of a string.
trim()
It is used to parse the string into variables.
parse_str()
A __ is a sequence of characters, denoting the date and/or time at which a certain event occurred.
timestamp
formatting options in date() function
- d
- D
- m
- M
- y
- Y
- Represents day of the month; two digits with leading zeros
- Represents day of the week in the text as an abbreviation
- Represents month in numbers with leading zeros (01 or 12).
- Represents month in text, abbreviated (Jan to Dec).
- Represents year in two digits (08 or 14).
- Represents year in four digits (2008 or 2014).
used to get the current time as a Unix timestamp (the number of seconds since the beginning of the Unix epoch: January 1, 1970, 00:00:00 GMT).
time () function
allow you to include the code contained in a PHP file within another PHP file.
include() and require()
The include and require statements are identical, except upon failure:
* ___ will produce a fatal error (E_COMPILE_ERROR) and stop the script
* ___ will only produce a warning\ (E_WARNING) and the script will continue
- require
- include