Learn PHP Tutorial 20 count, array merge and sort function

Publié le: 09 octobre 2015
sur la chaîne: Champion Mahipal
411
2

This video is made for learning about count, array merge and sort function in PHP.

The count() function returns the number of elements in an array.

Syntax
count(array,mode);

array_merge — Merge one or more arrays

Description ¶

array array_merge ( array $array1 [, array $... ] )
Merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array.

If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended.

Values in the input array with numeric keys will be renumbered with incrementing keys starting from zero in the result array.

Parameters ¶

array1
Initial array to merge.

...
Variable list of arrays to merge.

Return Values ¶

Returns the resulting array.

sort — Sort an array

Description ¶

bool sort ( array &$array [, int $sort_flags = SORT_REGULAR ] )
This function sorts an array. Elements will be arranged from lowest to highest when this function has completed.

Parameters ¶

array
The input array.

sort_flags
The optional second parameter sort_flags may be used to modify the sorting behavior using these values:

Sorting type flags:

SORT_REGULAR - compare items normally (don't change types)
SORT_NUMERIC - compare items numerically
SORT_STRING - compare items as strings
SORT_LOCALE_STRING - compare items as strings, based on the current locale. It uses the locale, which can be changed using setlocale()
SORT_NATURAL - compare items as strings using "natural ordering" like natsort()
SORT_FLAG_CASE - can be combined (bitwise OR) with SORT_STRING or SORT_NATURAL to sort strings case-insensitively
Return Values ¶

Returns TRUE on success or FALSE on failure.


Sur cette page du site, vous pouvez voir la vidéo en ligne Learn PHP Tutorial 20 count, array merge and sort function durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Champion Mahipal 09 octobre 2015, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 411 fois et il a aimé 2 téléspectateurs. Bon visionnage!