One Pager Cheat Sheet
PHPis anopen-source scripting languagewidely used for scripting the backend of a website, integrating well with HTML, CSS, and Javascript.- The
echolanguage construct in PHP can be used to output string(s) without surrounding parentheses, and can take multiple parameters, as demonstrated by the exampleecho "Hello" . " World!";. PHP echo is a language construct used to output strings and variables to the console.- The
printstatement is a function that returns an integer value of1when used to output strings and variables, unlike the language constructechowhich does not return a value. - The print statement
returns 1and takes oneargumentwhich can beprintedto theconsole, but isslowerthanecho. - The
gettype()function in PHP is used to determine the data type of the input expression, with the example expressions being a String, an Array and an Integer respectively. - The 8 fundamental data types in PHP are
String,Boolean,NULL,Array,Integer,Double,Object, andResource. - An Indexed Array in PHP is a type of array that stores multiple values in a single variable, where each element has an integer index or
key. - PHP supports
Indexed,Associative, andMulti-dimensionalarrays. - An
indexed arrayis a collection of values that are accessed by a numericindexstarting at zero, which is a concept familiar to many programmers. - An associative array is a
data structurein whichkey-value pairsare stored and can be accessed using the keys. - A
multi-dimensional arrayhas arrays within arrays and is just like a matrix with more than one row, with either indexed or associative arrays. - PHP's
foreachloop is an easy and syntactically simple way to iterate over arrays and objects. PHP foreach loopis a specialized construct used to efficiently loop over associative arrays and access key-value pairs.$greetings_explodeis being set to the output of theexplode()function, which splits astringinto an array, andgettype()can be used to return the data type of a variable, so the output of the code will be "array".- The
explodefunction in PHP splits a string into an array using a specific character as theseparator. - The same value can have different data types, such as
stringandinteger, so the answer is "Same value, different data types". - The
equaloperator (==) checks for equality in value, while theidenticaloperator (===) also checks for equality indata type. - Classes are
instantiatedwheninvokedto create an instance of the class, which then has the same properties and methods as defined by the class. - A PHP class is a
templateorblueprintfor creatingobjects. - An object is created with the
newkeyword and is an instance of a class, with the same attributes and methods as other objects of the same class.


