Raven 8.4 Problemskega zbirka PHP
Ob obisku strani zapišite v sejo čas obiska uporabnika. Po osvežitvi strani izpišite na zaslon čas zadnjega obiska uporabnika.
Podan je določen URL:
$url = 'http://test.com/dir1/dir2/dir3/page.html';
Pridobite iz njega mape v obliki polja:
['dir1', 'dir2', 'dir3']
Izpišite na zaslon naslednjo piramido:
1
22
333
4444
55555
666666
7777777
88888888
999999999
22
333
4444
55555
666666
7777777
88888888
999999999
Podan je seznam mest in njihovih držav, shranjen v naslednji strukturi:
<?php
$data = [
[
'country' => 'country1',
'city' => 'city11',
],
[
'country' => 'country2',
'city' => 'city21',
],
[
'country' => 'country3',
'city' => 'city31',
],
[
'country' => 'country1',
'city' => 'city12',
],
[
'country' => 'country1',
'city' => 'city13',
],
[
'country' => 'country2',
'city' => 'city22',
],
[
'country' => 'country3',
'city' => 'city31',
],
];
?>
Napišite kodo, ki bo preoblikovala strukturo podatkov v tole:
[
'country1': [
'city11', 'city12', 'city13',
],
'country2': [
'city21', 'city22'
],
'country3': [
'city31', 'city32'
],
]