From 7c8878219547b7dfa6372fed287400f0a78b7be1 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 12 Dec 2001 22:08:28 +0000 Subject: [PATCH] fix for #11937. pointing out that unset() will not cause a reindexing of an array when deleting a key. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@64875 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/types.xml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/language/types.xml b/language/types.xml index e5b0a70f28..310b70c2cb 100644 --- a/language/types.xml +++ b/language/types.xml @@ -1,5 +1,5 @@ - + Types @@ -1167,11 +1167,33 @@ $arr[] = value; with arrays, see the array-functions section. + + + The unset function allows unsetting keys of an + array. Be aware that the array will NOT be reindexed. + + + 'one', 2 => 'two', 3 => 'three' ); +unset( $a[2] ); +/* will produce an array that would have been defined as + $a = array( 1=>'one', 3=>'three'); + and NOT + $a = array( 1 => 'one', 2 => 'three'); +*/ +]]> + + + + + The foreach control structure exists specificly for arrays. It provides an easy way to traverse an array. + +