I need to learn more about arrays. If there is a site you know of that explains everything about php arrays, send it to me.
My basic question is, Can an array look like?: $array[1][4]
Any other help on this subject is appreciated.
Thanks for reading.
Arrays.
Moderator: General Moderators
- ambivalent
- Forum Contributor
- Posts: 173
- Joined: Thu Apr 14, 2005 8:58 pm
- Location: Toronto, ON
Re: Arrays.
YesEasyGoing wrote: My basic question is, Can an array look like?: $array[1][4]
php.net - arrays
Ch 5 - Arrays
HTH
- ambivalent
- Forum Contributor
- Posts: 173
- Joined: Thu Apr 14, 2005 8:58 pm
- Location: Toronto, ON
if you mean the length of all the characters in the array, you can just to this
Code: Select all
<?php
$length = implode(" ", $array);
$length = strlen($length);
echo("This array contains $length characters.");
?>No I just meant the length meaning how many values it has. But thanks for the post, it's good stuff. 
How does the count function works? Does it start at 0 like the arrays index does? Or is the first value in the array 1?
For example if I put:
$length = count($myarray);
and my array has:
so, and, what, not
would the first value (so) be 0 in $length or would it be 1?
How does the count function works? Does it start at 0 like the arrays index does? Or is the first value in the array 1?
For example if I put:
$length = count($myarray);
and my array has:
so, and, what, not
would the first value (so) be 0 in $length or would it be 1?