Php Utility-function Examples Adding the session ID to the notes table Communicating within Apache Parsing commmand-line arguments Using $argc and $argv in CLI PHP Using base64_decode(), the User Data Is Readable int connection_status ( void ) returns 0 if the connection is live; Retrieving a protected page with cURL int dl ( string extension_name ) loads an extension at runtime A Simple "Hello World" Script Add lines and spaces to textarea Correct escaping of special characters Formatting of Numeric Data Key-value array elements Echo out html tags Enclosure html into a string and echo out echo versus print how arrays embedded in strings will be converted. echo is more useful because you can pass it several parameters embedded variables are handled when the string is created with single or double quotes. Using escapeshellarg() Escaping shell metacharacters Escaping User Input with the escapeshellcmd() Function Executing df and displaying the results string escapeshellcmd ( string command ) escapes special characters in shell commands Execute a string as if it were PHP code using the eval( ) function Executing External Applications Using exec() string exec ( string command [, array &output [, int &return_val]] ) runs an external program Using exec() to Produce a Directory Listing void exit ( [mixed status] ) terminates execution of a script, and is an alias of the exit( ) function. void exit ( [mixed status] ) terminates execution of the script Using getenv() Using get_browser() array get_extension_funcs ( string extension_name ) returns an array of the functions available inside that extension. array get_loaded_extensions ( void ) takes no parameters and returns an array of the names of all extensions you have loaded. MD5 with the hash() function in PHP 5.1.2+ int ignore_user_abort ( [bool enable] ) carry on working after the user has cancelled her request Behavior of Files Included Using include Including Other Files Including files relative to the current file Using include to Load Files in PHP Using include() Within a Loop Using include() to Execute PHP and Assign the Return Value include_once and require_once will only include a file once include_once() function verifies whether or not the file has already been included. Using include_once to include a file Check to see the maximum post value size string ini_get ( string varname ) reads a value from the php.ini file without altering it Get information about PHP settings by ini_get() functionGet individual information about the current PHP settings Output system information string ini_set ( string varname, string value ) sets system attributes list($maths, $english, , $biology) = $scores; Using the list() function. Each line is converted into an array Extracting Values from an Array Using list() Add both name and address values into the email address mail() function mails information to a given recipient. mail-javascript.php Using mail() to redirect user information Encrypting and Sending Secure Emails Using S/MIME send-email-multiple-recipients-2.php send-email-with-headers.php send-mail-multiple-recipients.php send-plaintext-email.php Sending user-requested information Sends a HTML mail from a given email addressSending Internet Mail Sending Mail Sending a message with mail() mcrypt_encrypt.php Stronger Encryption Algorithms Using Mcrypt generic Symmetric Decryption Checking for session hijacking string md5 ( string str [, bool raw_output] ) string md5 ( string str [, bool raw_output] ) produces a data checksum in exactly the same way as sha1( ); Creating an md5 signature PHP's basic md5() function The protect() MD5 Form Fingerprint Generator md5.php Insert a unique ID into a form MD5 by way of the mhash extension mhash.php string nl2br ( string str ) inserts a HTML line break (br /) before all new line characters string nl2br ( string string )Wrapping Text with wordwrap() and nl2br() nl2br() function converts all newline (\n) characters to their HTML equivalent br. convert the newlines to br / Buffering output Using a callback with ob_start() URL Rewriting output_reset_rewrite_vars( ) Format characters for pack( ) and unpack( ) Generating fixed-width field data records Parsing a configuration file void parse_str ( string str [, array &arr] ) take a query string and convert it to variables Pass an array as the second parameter to parse_str( ), and it will put the variables into there Advanced PEARPEARQuick PEARphpinfo function Code Block Containing Multiple print() Statements Interpolating array element values in double-quoted strings Interpolating array element values with curly braces Using parentheses with these constructs Mix the output of date( ) with a text string to get a natural-looking statement Mix variable with string output Output string value Output value of a variable wit print function Printing a form printf « Utility Function « PHP@printf("pMathsAdding the pre and /pre tags so the spaces display printf and format printf and string format printf puts the numbers into the string printf() Type Specifiers printf() and Type Specifiers printf() and sprintf() Formatting Types Displaying signs with printf() Format an integer and a floating-point value with the printf() function. Format strings for use in printf( ) Formatting a price with printf() The printf function formats complex strings using a single expression. Use printf to output float numbers Using printf() to Format a List of Product Prices Working with printf() Zero-padding with printf() int printf ( string format [, mixed argument [, mixed ...]] ) is the standard C way to format text Demonstrating Some Type Specifiers Displaying a real number in money format Displaying long text with an ellipsis Displaying the same number in different formats ExampleLeft-aligned by prepending a minus symbol (-) to the field width specifier When you specify a color in HTML, you combine three hexadecimal numbers between 00 and FF. Pad with leading zeroesPadding Output with the Padding Specifier print_r(,true ) passes its output back as its return value, and not print anything out. Examining an Array with print_r() Setting an environment variable Handling DST with zoneinfo range( ) function creates an array of numbers between a low value and a high value. range( ) function has a third parameter that allows you specify a step amount in the range. If your low parameter (parameter one) is higher than your high parameter (parameter two), you get an array counting down, like thisInitializing an Array As a Range or Sequence of ValuesUse range( ) to create arrays of characters, like thisvoid register_shutdown_function ( function callback[, mixed param [, mixed ...]] ) registers with PHP a function to be run when script execution ends register_shutdown_function and sleep require() operates like include(), including a template. Using require to Load Files in PHP require_once() function ensures that the insertion file is included only once in your script. Saving Arrays Saving Objects Storing and Retrieving Objects Serialization Setting a default locale Setting a default locale based on system environment Setlocale() Options Generating Localized GMT/UTC Time and Date Strings Displaying Times and Dates in Other Languages setlocale(LC_MONETARY, 'en_DK'); setlocale(LC_MONETARY, 'en_US'); Preferred locale for Chinese Preferred locale for German Preferred locale for Russian To report local time for any Germans void set_time_limit ( int seconds ) sets how long a script should be allowed to execute. Comparing the output of md5 to that of sha1 string sha1 ( string str [, bool raw_output] ) Generating a Unique Identifier Using the shell_exec() Function Running a program with shell_exec() shmop Functions Sharing Variables Between Processes int sleep ( int seconds ) pauses execution for a set number of seconds, determined by the parameter you provide it. A Simple Movie Generating a Flash movie Calling the man Command Output man page pingserver.php portscanner.php Changing the default file permissions Another way to create a unique ID is to prepend the derived value with a stringfunction uniqid() generates a 13-character unique identification number based on the current time. Random unique id Encapsulating Complex Data Types convert the string produced by serialize() back into an object with the unserialize() function. Serialize and unserialize array void usleep ( int microseconds ) pauses script execution WDDX Functions in PHP Transfer data from one server to another. Setting Environment and Configuration Variables Reading Environment and Configuration Variables Reading an environment variable, $_ENV['USER'] Reading another environment variable,$_ENV['HOME']

Php Code : Using The List() Function.

Using the list() function. in php

$net_address = array("", "", ""); 
list($ip_addr, $net_mask, $gateway) = $net_address; 
echo "ip addr = $ip_addr\n"; 
echo "net mask = $net_mask\n"; 
echo "gateway = $gateway\n";