Mark As Completed Discussion

One Pager Cheat Sheet

  • PHP is an open-source scripting language widely used for scripting the backend of a website, integrating well with HTML, CSS, and Javascript.
  • The echo language construct in PHP can be used to output string(s) without surrounding parentheses, and can take multiple parameters, as demonstrated by the example echo "Hello" . " World!";.
  • PHP echo is a language construct used to output strings and variables to the console.
  • The print statement is a function that returns an integer value of 1 when used to output strings and variables, unlike the language construct echo which does not return a value.
  • The print statement returns 1 and takes one argument which can be printed to the console, but is slower than echo.
  • 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, and Resource.
  • 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, and Multi-dimensional arrays.
  • An indexed array is a collection of values that are accessed by a numeric index starting at zero, which is a concept familiar to many programmers.
  • An associative array is a data structure in which key-value pairs are stored and can be accessed using the keys.
  • A multi-dimensional array has arrays within arrays and is just like a matrix with more than one row, with either indexed or associative arrays.
  • PHP's foreach loop is an easy and syntactically simple way to iterate over arrays and objects.
  • PHP foreach loop is a specialized construct used to efficiently loop over associative arrays and access key-value pairs.
  • $greetings_explode is being set to the output of the explode() function, which splits a string into an array, and gettype() can be used to return the data type of a variable, so the output of the code will be "array".
  • The explode function in PHP splits a string into an array using a specific character as the separator.
  • The same value can have different data types, such as string and integer, so the answer is "Same value, different data types".
  • The equal operator (==) checks for equality in value, while the identical operator (===) also checks for equality in data type.
  • Classes are instantiated when invoked to create an instance of the class, which then has the same properties and methods as defined by the class.
  • A PHP class is a template or blueprint for creating objects.
  • An object is created with the new keyword and is an instance of a class, with the same attributes and methods as other objects of the same class.