A weak problem $ Foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese ");
$ Bar = each ($ foo );
Print_r ($ bar );
?>
Which one can parse it in detail? =-= I don't know the output result.
Reply to discussion (solution)
Php system functions have nothing to explain. just know how to use them.
Returns the key/value pair of the current pointer position in the array and moves the array pointer forward. The key-value pair is returned as an array of four units, with the key names 0, 1, key, and value. Unit 0 and key contain the key name of the array unit, and 1 and value contain data.
If the internal pointer crosses the end of the array, each () returns FALSE.
Is there a description in the manual? how can this problem be solved.
$ Foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese ");
Foreach ($ foo, $ key, $ value)
{
Echo "subscript". $ key. "value:". $ value;
}
// The following should output the first element
$ Bar = each ($ foo );
Print_r ($ bar );
?>
Php system functions have nothing to explain. just know how to use them.
Returns the key/value pair of the current pointer position in the array and moves the array pointer forward. The key-value pair is returned as an array of four units, with the key names 0, 1, key, and value. Unit 0 and key contain the key name of the array unit, and 1 and value contain data.
If the internal pointer crosses the end of the array, each () returns FALSE.
Why is the key name 0 and key secret? The key value is the same, and the key value is the same as the key value.
Php arrays have two manifestations:
One is a subscript array that uses numbers as the subscript for access
One is join array, also named join key access
Only one element of the same array can be used.
This is because the each function returns the array information in two forms for you to choose to use
Php arrays have two manifestations:
One is a subscript array that uses numbers as the subscript for access
One is join array, also named join key access
Only one element of the same array can be used.
This is because the each function returns the array information in two forms for you to choose to use
Key and 0 value and 1 are default values.
Yes
0 and 1, key and value
Yes
0 and 1, key and value
Thanks