String Formation Through Loops in PHP

Using loops, you can form strings. Let's create a string filled with ten letters 'x' as an example:

php<?php
  $str = '';
  
  for ($i = 0; $i < 10; $i++) {
    $str .= 'x';
  }
  
  echo $str;
?>

Now let's make a string '12345'. To do this, we will add the loop counter to our variable:

php<?php
  $str = '';
  
  for ($i = 1; $i <= 5; $i++) {
    $str = $str . $i;
  }
  
  echo $str; // will output '12345'
?>
Задание 1

Using a loop, form a string filled with 5 hyphens.

Задание 2

Using a loop, form the string '123456789'.

Задание 3

Using a loop, form the string '987654321'.

Задание 4

Using a loop, form the string '-1-2-3-4-5-6-7-8-9-'.