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.

Returns the portion of string from the first occurrence of character until the end of string.<br />

If character is not found, the function returns false. Ifcharacter contains more than one<br />

character, only the first is used.<br />

strtok<br />

string strtok(string string, string token)<br />

string strtok(string token)<br />

Breaks string into tokens separated by any of the characters in token and returns the next<br />

token found. The first time you call strtok( ) on a string, use the first function prototype;<br />

afterwards, use the second, providing only the tokens. The function contains an internal<br />

pointer for each string it is called with. For example:<br />

$string = "This is the time for all good men to come to the aid of their country."<br />

$current = strtok($string, " .;,\"'");<br />

while(!($current === FALSE)) {<br />

print($current . "";<br />

}<br />

strtolower<br />

string strtolower(string string)<br />

Returns string with all alphabetic characters converted to lowercase. The table used for<br />

converting characters is locale-specific.<br />

strtotime<br />

int strtotime(string time[, int timestamp])<br />

Converts an English description of a time and date into a Unix timestamp value. Optionally,<br />

a timestamp can be given that the function uses as the “now” value; if not, the current<br />

date and time is used.<br />

The descriptive string can be in a number of formats. For example, all of the following will<br />

work:<br />

echo strtotime("now");<br />

echo strtotime("+1 week");<br />

echo strtotime("-1 week 2 days 4 seconds");<br />

echo strtotime("2 January 1972");<br />

strtoupper<br />

string strtoupper(string string)<br />

Returns string with all alphabetic characters converted to uppercase. The table used for<br />

converting characters is locale-specific.<br />

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

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

strtoupper | 449

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

Saved successfully!

Ooh no, something went wrong!