PHP: How to print information about variables, arrays, and objects

To print information about variables, arrays or objects in PHP, we can use the following functions: print_r() var_dump() var_export() print_r( ) According to this explanation on stackoverflow.com, print_r(): Outputs a human-readable representation of any one value Accepts not just strings but other types including arrays and objects, formatting them to be readable Useful when debugging … Continue reading PHP: How to print information about variables, arrays, and objects

PHP: How to output text, variables, and HTML markup using print and echo

In PHP there are two ways to “print” HTML markup, text, and variables, using print and echo. These are essentially interchangeable, though print is slower, so best practice is to use echo. “print” has a return value of 1 (so it can be used in expressions), while “echo” does not.  print can take one argument, … Continue reading PHP: How to output text, variables, and HTML markup using print and echo