lecture25 - PIC 40A Lecture 25 More PHP Arrays PHP Array...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
PIC 40A Lecture 25: More PHP Arrays
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
PHP Array functions •unset – deletes the contents of a scalar variable, an array entry, or an entire array •count – returns the number of elements in an array •sizeof – same as count
Image of page 2
Example $list = array(1,2,3,4); #keys 0,1,2,3 $a = 5; unset ($list[2]); # now $list has keys 0,1,3 and elements 1,2,4 unset ($list); #now $list is NULL unset ($a); #now $a is NULL
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
PHP Array Conversions •explode($delim, $str) – explodes a string $str into substrings using the given delimiter $delim and returns them in an array •implode($delim, $strarray) – does the inverse of explode by joining the elements of $strarray as a string while wedging the given $delim in between each element. The resulting string is returned.
Image of page 4