<?php

/* 
 * Przykładowy kod do książki: Algorytmy i struktury danych w języku PHP 7
 * 
 * Autor: Mizanur Rahman <mizanur.rahman@gmail.com>
 * 
 */

$countries = [];
array_push($countries, 'Bangladesz', 'Bhutan');


$countries = ["Bangladesz", "Nepal", "Bhutan"];

$key = array_search("Bangladesz", $countries);
if ($key !== FALSE)
   echo "Znaleziono w: " . $key;
else
   echo "Nie znaleziono";


$countries = ["bangladesz", "nepal", "bhutan"];
$newCountries = array_map(function($country) {
   return strtoupper($country);
}, $countries);

foreach ($newCountries as $country)
   echo $country . "\n";

   
$countries = ["bangladesz", "nepal", "bhutan"];
$newCountries = array_map('strtoupper', $countries);

foreach ($newCountries as $country)
   echo $country . "\n";


$countries = ["bangladesz", "nepal", "bhutan"];
$top = array_shift($countries);
echo $top;


$baseNumber = "123456754";
$newNumber = base_convert($baseNumber, 8, 16);
echo $newNumber;