[Löst] Reversed Chars - PHP Task

  

5
Ämnesstart

Write a program that takes 3 lines of characters and prints them in reversed order with a space between them.

Examples:

reversed chars php task

3 Svar
4

Mine is with strrev string function (line #8):

<?php
 
$chars = '';
for ($i = 0; $i < 3; $i++) {
    $chars .= readline()." ";
}
 
echo strrev($chars);
2

My solution:

<?php
 
$input1 = readline();
$input2 = readline();
$input3 = readline();
 
echo "$input3 $input2 $input1";
1

Mine:

<?php
 
$chars = '';
for ($i = 0; $i < 3; $i++) {
    $chars .= readline();
}
 
$output = '';
for ($i = 2; $i >= 0; $i--) {
    $output .= $chars[$i] . " ";
}
 
echo $output;
Dela: