Created
September 6, 2018 13:39
Star
You must be signed in to star a gist
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 == 0) | |
{ | |
echo " любая не пустая строка \n"; | |
} | |
if ($i % $b == 0) | |
{ | |
if ($i % $a *$b == 0) | |
{ | |
shuffle($items); | |
} | |
$sum += $i; | |
echo $sum . "\n"; | |
} | |
} | |
foreach ($items as $element) | |
{ | |
echo $element . " "; | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
тест пхп