I have an array:
$array = array();
$array[0] = "string";
$array[1] = "string1";
$array[2] = "string2";
$array[3] = "string3";
...
$array[99] = "string99";
$array[100] = "string100";
If I want to work with all the values of the array:
foreach ($array as $key => $value)
{
// Do something with the value
}
Depending on a condition, I might need to work with only portion of the array (for example 50-100). How do I extract key 50-100 from the array?
There is this way but it doesn't seem much efficient:
foreach ($array as $key => $value)
{
if ($key > 49)
{
// Do something with the value
}
}
Are there any better, more-efficient ways to do it?