Created
September 6, 2018 14:37
-
-
Save UlvacMoscow/e7710b689873ef6f532c3f02f70ec29c to your computer and use it in GitHub Desktop.
TestPHP created by Ulvac - https://repl.it/@Ulvac/TestPHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "-------------------------------задание 1--------------------------\n"; | |
$authors = | |
[ | |
["name" => "ivan ivanov", | |
"email" => "ivan@mail.hell", | |
"birthday" => "1888", | |
"books" => [ | |
["name" => 'mertvec', | |
"publishing" => 1907,], | |
["name" => 'mertvec2', | |
"publishing" => 1909,] | |
] | |
], | |
["name" => "vasja ivanov", | |
"email" => "vasja@mail.hell", | |
"birthday" => "1889", | |
"books" => [ | |
["name" => 'den1', | |
"publishing" => 1933,], | |
["name" => 'den2', | |
"publishing" => 1935,] | |
] | |
], | |
["name" => "petr ivanov", | |
"email" => "petr@mail.hell", | |
"birthday" => "1898", | |
"books" => [ | |
["name" => 'noch', | |
"publishing" => 1921,], | |
["name" => 'noch2', | |
"publishing" => 1922,] | |
] | |
] | |
]; | |
echo "Авторы : \n"; | |
foreach ($authors as $author) | |
{ | |
echo $author['name'] . " - " . $author['email'] . " - " . $author['birthday'] . "\n"; | |
} | |
echo "Книги : \n"; | |
foreach ($authors as $books) | |
{ | |
foreach ($books['books'] as $book) | |
{ | |
echo $book["name"] . " - " . $books["name"] . " - " . $book["publishing"] . "\n"; | |
} | |
} | |
echo "-------------------------------задание 2--------------------------\n"; | |
$items = ['where','is','my','money']; | |
$sum = 0; | |
$a = 3; | |
$b = 5; | |
for($i = 0; $i <= 100; $i++) | |
{ | |
if ($i % ($a * $b) == 0) | |
{ | |
shuffle($items); | |
continue; | |
} | |
if ($i % $a == 0) | |
{ | |
echo " любая не пустая строка \n"; | |
continue; | |
} | |
if ($i % $b == 0) | |
{ | |
$sum += $i; | |
} | |
} | |
foreach ($items as $element) | |
{ | |
echo $element . " "; | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment