Answer the question
In order to leave comments, you need to log in
How will this ruby code be in php?
for i in (1..7).reverse_each do
puts "Осталось #{i} секунд#{case i
when 2..4 then "ы"
when 1 then "а"
else ""
end }..."
sleep(1)
end
puts "Готово!
Answer the question
In order to leave comments, you need to log in
<?php
for ($i = 7; $i >= 1; $i--) {
$ending = '';
if ($i === 1) {
$ending = 'a';
} elseif ($i >= 2 && $i <= 4) {
$ending = 'ы';
}
echo "Осталось {$i} секунд{$ending} ...\n";
sleep(1);
}
echo "Готово!";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question