05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The parameter mode specifies the permissions to open the file with, which can only be<br />

unidirectional (that is, for reading or writing only). mode must be one of the following:<br />

If any error occurs while attempting to open the pipe, false is returned. If not, the resource<br />

handle for the pipe is returned.<br />

pos<br />

mixed pos(array array)<br />

This function is an alias for current( ).<br />

pow<br />

mixed pow(double base, double exponent)<br />

Returns base raised to the exponent power. When possible, the return value is an integer; if<br />

not, it is a double.<br />

prev<br />

mixed prev(array array)<br />

Moves the internal pointer to the element before its current location and returns the value of<br />

the element to which the internal pointer is now set. If the internal pointer is already set to<br />

the first element in the array, returns false. Be careful when iterating over an array using this<br />

function—if an array has an empty element or an element with a key value of 0, a value<br />

equivalent to false is returned, causing the loop to end. If an array might contain empty<br />

elements or an element with a key of 0, use the each( ) function instead of a loop with prev( ).<br />

print<br />

r Open file for reading; file pointer will be at beginning of file.<br />

w Open file for writing. If the file exists, it will be truncated to zero length; if<br />

the file doesn’t already exist, it will be created.<br />

void print(string string)<br />

Outputs string. Similar to echo, except that it takes a single argument.<br />

print_r<br />

bool print_r(mixed value)<br />

Outputs value in a human-readable manner. If value is a string, integer, or double, the<br />

value itself is output; if it is an array, the keys and elements are shown; and if it is an object,<br />

the keys and values for the object are displayed. This function returns true.<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.<br />

print_r | 433

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!