[Solved] Chars to String - PHP Task

  

4
Topic starter

Write a program that reads 3 lines of input. On each line you get a single character. Combine all the characters into one string and print it on the console.

Examples:

chars to string php task

2 Answers
3

Solution:

<?php
 
$input1 = readline();
$input2 = readline();
$input3 = readline();
 
echo $input1 . $input2 . $input3;
2

Another solution:

<?php
 
$result = '';
for ($i = 0; $i < 3; $i++) {
    $input = readline();
    $result .= $input;
}
 
echo $result;
Share: