Created
September 6, 2018 14:02
-
-
Save UlvacMoscow/ceeacc383738ab072eafba9361c8f62b 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 | |
/*-------------------------------задание 1--------------------------*/ | |
$books = [ | |
["name" => 'mertvec', | |
"publishing" => 1901, | |
"author" => [ | |
"name" => "ivan ivanov", | |
"email" => "ivan@mail.hell", | |
"birthday" => "1888" | |
] | |
], | |
["name" => 'mertvec2', | |
"publishing" => 1902, | |
"author" => [ | |
"name" => "ivan ivanov", | |
"email" => "ivan@mail.hell", | |
"birthday" => "1888" | |
] | |
], | |
["name" => 'slovo', | |
"publishing" => 1905, | |
"author" => [ | |
"name" => "vasja ivanov", | |
"email" => "vasja@mail.hell", | |
"birthday" => "1889" | |
] | |
], | |
["name" => 'slovo2', | |
"publishing" => 1909, | |
"author" => [ | |
"name" => "vasja ivanov", | |
"email" => "vasja@mail.hell", | |
"birthday" => "1889" | |
] | |
], | |
["name" => 'den', | |
"publishing" => 1909, | |
"author" => [ | |
"name" => "petr ivanov", | |
"email" => "petr@mail.hell", | |
"birthday" => "1898" | |
] | |
], | |
["name" => 'den2', | |
"publishing" => 1911, | |
"author" => [ | |
"name" => "petr ivanov", | |
"email" => "petr@mail.hell", | |
"birthday" => "1898" | |
] | |
] | |
]; | |
$a = 0; | |
echo "Авторы : \n"; | |
foreach ($books as $value) | |
{ | |
echo $value['author']['name'] . " - " . $value['author']['email'] . " - " . $value['author']['birthday'] . "\n"; | |
} | |
echo "Книги : \n"; | |
foreach ($books as $value) | |
{ | |
echo $value["name"] . " - " . $value["author"]["name"] . " - " . $value["publishing"] . "\n"; | |
} | |
/*-------------------------------задание 2--------------------------*/ | |
$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