update page now

Voting

: five plus three?
(Example: nine)

The Note You're Voting On

biziclop at vipmail dot hu
7 years ago
<?php
//Be careful when using array_pop/shift/push/unshift with irregularly indexed arrays:
$shifty = $poppy = array(
 2 => '(2)',
 1 => '(1)',
 0 => '(0)',
); print_r( $shifty );
array_shift( $shifty ); print_r( $shifty );
// [0] => (1)
// [1] => (0)
array_pop( $poppy ); print_r( $poppy );
// [2] => (2)
// [1] => (1)
$shifty = $poppy = array(
 'a' => 'A',
 'b' => 'B',
 '(0)',
 '(1)',
 'c' => 'C',
 'd' => 'D',
); print_r( $shifty );
array_shift( $shifty ); print_r( $shifty );
// [b] => B
// [0] => (0)
// [1] => (1)
// [c] => C
// [d] => D
array_unshift( $shifty, 'unshifted'); print_r( $shifty );
// [0] => unshifted
// [b] => B
// [1] => (0)
// [2] => (1)
// [c] => C
// [d] => D
array_pop( $poppy ); print_r( $poppy );
// [a] => A
// [b] => B
// [0] => (0)
// [1] => (1)
// [c] => C
array_push( $poppy, 'pushed'); print_r( $poppy );
// [a] => A
// [b] => B
// [0] => (0)
// [1] => (1)
// [c] => C
// [2] => pushed
?>

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /