home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Programming PHPProgramming PHPSearch this book

A.2a. Alphabetical Listing of PHP Functions (a-e)

array

array array([mixed ...])

Creates an array using the parameters as elements in the array. By using the => operator, you can specify specific indexes for any elements; if no indexes are given, the elements are assigned indexes starting from 0 and incrementing by one. The internal pointer (see current, reset, and next) is set to the first element.

$array = array("first", 3 => "second", "third", "fourth" => 4);

Note: array is actually a language construct, used to denote literal arrays, but its usage is similar to that of a function, so it's included here.

call_user_func_array

mixed call_user_func_array(string function, array parameters)

Similar to call_user_func( ), this function calls the function named function with the parameters in the array parameters. The comparison to check for a matching function is case-insensitive. Returns the value returned by the function.

call_user_method

mixed call_user_method(string function, mixed object[, mixed parameter1
                       [, ... mixed parameterN]])

Calls the method given in the first parameter on the object in the second parameter. Additional parameters are used as parameters when calling the method. The comparison to check for a matching method name is case-insensitive. Returns the value returned by the function.

closedir

void closedir([int handle])

Closes the directory stream referenced by handle. See opendir for more information on directory streams. If handle is not specified, the most recently opened directory stream is closed.

date

string date(string format[, int timestamp])

Formats a time and date according to the format string provided in the first parameter. If the second parameter is not specified, the current time and date is used. The following characters are recognized in the format string:

 

a

 

"am" or "pm"

 

A

 

"AM" or "PM"

 

B

 

Swatch Internet time

 

d

 

Day of the month as two digits, including a leading zero if necessary; e.g., "01" through "31"

 

D

 

Name of the day of the week as a three-letter abbreviation; e.g., "Mon"

 

F

 

Name of the month; e.g., "August"

 

g

 

Hour in 12-hour format; e.g., "1" through "12"

 

G

 

Hour in 24-hour format; e.g., "0" through "23"

 

h

 

Hour in 12-hour format, including a leading zero if necessary; e.g., "01" through "12"

 

H

 

Hour in 24-hour format, including a leading zero if necessary; e.g., "00" through "23"

 

I

 

Minutes, including a leading zero if necessary; e.g., "00" through "59"

 

I

 

"1" if Daylight Savings Time; "0" otherwise

 

j

 

Day of the month; e.g., "1" through "31"

 

l

 

Name of the day of the week; e.g., "Monday"

 

L

 

"0" if the year is not a leap year; "1" if it is

 

m

 

Month, including a leading zero if necessary; e.g., "01" through "12"

 

M

 

Name of the month as a three-letter abbreviation; e.g., "Aug"

 

n

 

Month without leading zeros; e.g.,"1" to "12"

 

r

 

Date formatted according to RFC 822; e.g., "Thu, 21 Jun 2001 21:27:19 +0600"

 

s

 

Seconds, including a leading zero if necessary; e.g., "00" through "59"

 

S

 

English ordinal suffix for the day of the month; either "st", "nd", or "th"

 

t

 

Number of days in the month, from "28" to "31"

 

T

 

Timezone setting of the machine running PHP; e.g., "MST"

 

U

 

Seconds since the Unix epoch

 

w

 

Numeric day of the week, starting with "0" for Sunday

 

W

 

Numeric week of the year according to ISO 8601

 

Y

 

Year with four digits; e.g., "1998"

 

y

 

Year with two digits; e.g., "98"

 

z

 

Day of the year, from "1" through "365"

 

Z

 

Time zone offset in seconds, from "-43200" (far west of UTC) to "43200" (far east of UTC)

Any characters in the format string not matching one of the above will be kept in the resulting string as-is.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.