faqts : Computers : Programming : Languages : PHP : Function Libraries : Variables

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 8 people (75%) answered Yes
Recently 2 of 3 people (67%) answered Yes

Entry

[+] print_f : Prints human-readable information about a variable

Dec 23rd, 2000 19:35
Philip Olson,


Function : print_r
Version  : PHP4
Man      : http://www.php.net/manual/function.print-r.php 
Desc     : "This function displays information about the values of
            variables in a way that's readable by humans. If given 
            a string, integer or double, the value itself will be
            printed. If given an array, values will be presented in 
            a format that shows keys and elements. Similar notation 
            is used for objects." -- from manual. 
Explain  : print_f provides valuable information about a given 
           input.  very useful for debugging!
Example  : Here's an example of print_r() 's use.
-----------------------------------------------------------------------
Use      :
           <pre>
           <?php  
               print_r($HTTP_POST_VARS);
           ?>
           </pre>
-----------------------------------------------------------------------
Input    :
           <pre>
            <form method="get" action="<?php $PHP_SELF; ?>">
               Name    :<input type="text" name="name">
               Email   :<input type="text" name="email">
               Subject :<input type="text" name="subject">
               Message :<input type="text" name="message">
               <input type="submit" name="submit">
            </form>
           </pre>
-----------------------------------------------------------------------
Output   : (assuming message field left empty)
           Array
           (
               [name] => joe smith
               [email] => joe@example.com
               [subject] => what is up! 
               [message] =>
           )
-----------------------------------------------------------------------