var_dump and print_r -PHP-standard

Functions like var_dump and print_r are also invaluable when debugging

var_dump

var_dump functions displays information about variables in a simple, readable 
format. This function is very useful when debugging—providing a simple
 and easy way to display the current contents of one or more variables.

For simple scalar variables such as booleans, integers, strings, and doubles,
 the type of the variable is printed, followed by an opening bracket, the value
 contained in the variable, and a closing bracket.

Arrays are printed as a list of keys and values, and have their type array
 printed at the top of the list.

print_r

print_r displays information about a variable in a format meant to
 be easily understandable by humans. It is often used for debugging—
providing a simple and easy way to display the current contents of a variable.
 However, var_dump provides more complete information and allows
 for the use of multiple arguments.
For simple scalar variables, such as booleans, integers, strings, 
and doubles, the value contained in the variable is printed.

If print_r is used on a data structure that is a reference to itself, 
the function enters a recursive loop—generating the same information
 repeatedly until the script times out or the user cancels the script.

Related Posts:
  • Using Cookie Authentication PHP Store authentication status in a cookie or as part of a session. When a user logs insuccessfully, put their username in a cookie. Also include a hash of the username and a secretword so a user can't just make up an authentic… Read More
  • Defining Functions There are already many functions built into PHP. However, you can define your own and organize your code into functions. To define your own functions, start out with the function statement: function some_function([argumen… Read More
  • Php Directory Functions chdir — Change directory chroot — Change the root directory closedir — Close directory handle dir — Return an instance of the Directory class getcwd — Gets the current working directory opendir — Open directory handle read… Read More
  • File Manipulation 11.3. File Manipulation There may be times when you don't want to store information in a database and may want to work directly with a file instead. An example is a logfile that tracks when your application can't co… Read More
  • Including and Requiring PHP Files To make your code more readable, you can place your functions in a separate file. Many PHP add-ons that you download off the Internet contain functions already placed into files that you simply include in your PHP program… Read More
  • Showing the Browser and IP Address Here is a simple page that prints out the browser string and the IP address of the HTTP request. Create a file with the following content in your web directory, name it something like example.php3, and load it in your bro… Read More
  • Php Mysql Image upload <?php // 1. Gem modtagne formulardata i variabler: $navn = $_POST['navn']; $alder = $_POST['alder']; $postnr = $_POST['postnr']; $mail = $_POST['mail']; $billede = $_FILES['profilbillede']; $password = $_PO… Read More
  • PHP - Echo <?php $myiString = "Hi!"; echo $myiString; echo "<h5>I love PHP!</h5>"; ?>   Display: Hi! I love  PHP!  A simple form example     1 <html> 2 <head> 3 <title&g… Read More
  • Create Dynamic Database Access Objects Some simple PHP that makes for a surprisingly robust script <?php require_once( "DB.php" ); $dsn = 'mysql://root:password@localhost/books'; $db =& DB::Connect( $dsn, array() ); if (PEAR::isError($db)) { die($db->g… Read More
  • PHP Data Types PHP provides four primitive data types: integers, floating point numbers, strings, and booleans. In addition, there are two compound data types: arrays and objects.  Integers Integers are whole numbers. The range… Read More
  • PHP Functions A function is a named sequence of code statements that can optionally accept parameters and return a value. A function call is an expression that has a value; its value is the returned value from the function. PHP provid… Read More
  • Convert CSV to PHP Every once in a while, I have a static list of values that I don't want to put into a database, but that I do want to use in my PHP application. That static data can come from a variety of sources, but often it's in a s… Read More
  • Configuring the Connection Mysql <?phptry{$pdo = new PDO('mysql:host=localhost;dbname=ijdb', 'ijdbuser','mypassword');}catch (PDOException $e){$output = 'Unable to connect to the database server.';include 'output.html.php';exit();} $pdo->setAttribute(… Read More
  • PHP Web-Related Variables PHP automatically creates variables for all the data it receives in an HTTP request. This can include GET data, POST data, cookie data, and environment variables. The variables are either in PHP's global symbol table or … Read More
  • MySQL Data on the Web Before we leap forward, it’s worth taking a step back for a clear picture of our ultimategoal. We have two powerful tools at our disposal: the PHP scripting languageand the MySQL database engine. It’s important to understand… Read More