For Loop for Arrays in PHP

Suppose we have the following array:

php<?php
  $arr = [1, 2, 3, 4, 5];
?>

As you know, arrays are iterated using the foreach loop. In fact, array elements can also be iterated with a regular for loop. This is rarely needed, but sometimes it can be useful. Let's perform such an iteration:

php<?php
  $arr = [1, 2, 3, 4, 5];
  $length = count($arr);
  
  for ($i = 0; $i < $length; $i++) {
    echo $arr[$i];
  }
?>
Задание 1

Given an array:

php<?php
  $arr = ['a', 'b', 'c', 'd', 'e'];
?>

Using a for loop, display all these elements on the screen.

Задание 2

Given an array:

php<?php
  $arr = ['a', 'b', 'c', 'd', 'e'];
?>

Using a for loop, display all elements of this array except the last one.

Задание 3

Given an array:

php<?php
  $arr = [1, 2, 3, 4, 5, 6, 7, 8];
?>

Using a for loop, display the first half of the elements of this array.