1. Trang chủ
  2. » Công Nghệ Thông Tin

PHP Developer''''s Dictionary- P26 docx

5 149 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 360,72 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

next Syntax mixed nextarray array Description The next function advances the internal pointer by one and returns the element located at this new location.. The current function retur

Trang 1

The list() language construct is used to assign a list of variables in one operation The construct list() is commonly used to assign multiple return values of a function

to variables

next()

Syntax

mixed next(array array)

Description

The next() function advances the internal pointer by one and returns the element located at this new location If there are no more elements in array to advance to,

the function returns false Note that this function also returns false if the value of the element at this location is empty

pos()

Syntax

mixed pos(array array)

Description

The pos() function is an alias to the current() function The current() function returns the element in array that is currently being pointed to by the internal

pointer Every array has this internal pointer, which is initialized to point to the first element inserted into the array If the internal pointer points beyond the element list, the function returns false

prev()

Syntax

mixed prev(array array)

Description

The prev() function rewinds the internal array pointer by one and returns the

Trang 2

false Note that this function also returns false if the value of the element at this location is empty

range()

Syntax

array range(int low, int high)

Description

The range() function, which was added in PHP 3.0.8 and PHP 4.0b4, returns an array of integers from low to high

$array1 = range(1,4);//returns (1,2,3,4)

reset()

Syntax

mixed reset(array array)

Description

The reset() function moves the internal array pointer to the first element in array

and returns the value of the first element

rsort()

Syntax

void rsort(array array)

Description

The rsort() function sorts the array in reverse order (highest to lowest)

shuffle()

Trang 3

Syntax

void shuffle(array array)

Description

The shuffle() function, which was added in PHP 3.0.8 and PHP 4.0b4, randomizes the order of the elements in array

sizeof()

Syntax

int sizeof(array array)

Description

The sizeof() function returns the number of elements in the array Empty

elements are included in the count This function is similar to count(), but is used specifically for arrays

$array1 = array (1,2,3,4,5,"pos"=>"",);

echo sizeof ($array1);//displays 6

sort()

Syntax

void sort(array array)

Description

The sort( ) function orders the elements of array The resulting array is sorted

from lowest to highest

uasort()

Syntax

Trang 4

void uasort(array array, function cmp_function)

Description

The uasort() function, which was added in PHP 3.0.4 and PHP 4.0, sorts the array based on a user-defined comparison function The array indices maintain their

relation to the array elements with which they are associated

uksort()

Syntax

void uksort(array array, function cmp_function)

Description

The uksort() function , which was added in PHP 3.0.4 and PHP 4.0, sorts the array

by keys using a user-defined comparison function

usort()

Syntax

void usort(array array, function cmp_function)

Description

The usort() function, which was added in PHP 3.0.3 and PHP 4.0, sorts the array

by values using a user-defined comparison function

Dynamic Loading

Loading additional libraries at runt ime can extend the functionality of PHP After the external libraries have been loaded, you can call functions from this library as though they were part of PHP

dl()

Syntax

int dl(string library)

Trang 5

Description

The dl() function loads the library , which is a PHP extension The library should

be placed in the directory specified by the extension_dir directive

Hash()

PHP offers many hashing options through the use of the mhash library To utilize these functions, you must download the library from http://sasweb.de/mhash/ and then compile PHP with the with-mhash option to enable it The hashing routines include SHA1, GOST, HAVAL, MD5, RIPEMD160, TIGER, and CRC32 checksums

mhash_get_hash_name()

Syntax

string mhash_get_hash_name(int hash)

Description

The mhash_get_hash_name() function, which was added in PHP 3.0.9 and PH P 4.0, returns the name of the hash associated with hash , which represents a hash ID If

no hash name corresponds to the hash ID, the function returns false

mhash_get_block_size()

Syntax

int mhash_get_block_size(int hash)

Description

The mhash_get_block_size() function, which was added in PHP 3.0.9 and PHP 4.0, returns the block size for a given hash

mhash_count()

Syntax

Ngày đăng: 07/07/2014, 05:20

TỪ KHÓA LIÊN QUAN