5
05/11/2024 12:58 pm
Topic starter
Write a program that takes 3 lines of characters and prints them in reversed order with a space between them.
Examples:
3 Answers
4
05/11/2024 12:59 pm
Mine is with strrev string function (line #8):
<?php $chars = ''; for ($i = 0; $i < 3; $i++) { $chars .= readline()." "; } echo strrev($chars);
2
05/11/2024 1:00 pm
My solution:
<?php $input1 = readline(); $input2 = readline(); $input3 = readline(); echo "$input3 $input2 $input1";
1
05/11/2024 1:01 pm
Mine:
<?php $chars = ''; for ($i = 0; $i < 3; $i++) { $chars .= readline(); } $output = ''; for ($i = 2; $i >= 0; $i--) { $output .= $chars[$i] . " "; } echo $output;