Severity: 8192
Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 113
Severity: 8192
Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 280
Severity: 8192
Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 145
Severity: 8192
Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 223
Severity: 8192
Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 303
Severity: 8192
Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Filename: drivers/Session_files_driver.php
Line Number: 344
Severity: 8192
Message: setcookie(): Passing null to parameter #7 ($httponly) of type bool is deprecated
Filename: core/Input.php
Line Number: 410
Makale başlığında da belirtildiği üzere PHP'de dizilerde sıralama yapmaya yarayan çeşitli fonksiyonlar vardır. Dizideki elemanları alfabetik ya da sayısal açıdan, azalan ya da artan bir şekilde sıralayabiliriz. Şimdi tek tek sort() rsort() asort() ksort() arsort() ve krsort() fonksiyonlarını açıklayıp örneklendirelim.
sort() - dizi elemanlarını alfabetik ya da sayısal açıdan artan bir şekilde sıralar
rsort() - dizi elemanlarını alfabetik ya da sayısal açıdan azalan bir şekilde sıralar
asort() - anahtarlı dizilerde, anahtarın değerine göre artan bir şekilde sıralar
arsort() - anahtarlı dizilerde, anahtarın değerine göre azalan bir şekilde sıralar
ksort() - anahtarlı dizilerde, anahtara göre artan bir şekilde sıralar
krsort() - anahtarlı dizilerde, anahtara göre azalan bir şekilde sıralar
Örnek 1: sort()
<?php
$filmler = array("Testere","Matrix","Hobbit");
sort($filmler);
print_r($filmler);
/* Sıralı Çıktı
Array
(
[0] => Hobbit
[1] => Matrix
[2] => Testere
)
*/
?>
Örnek 2: sort()
<?php
$sayilar = array(5,11,9,19,2);
sort($sayilar);
print_r($sayilar);
/* Sıralı Çıktı
Array
(
[0] => 2
[1] => 5
[2] => 9
[3] => 11
[4] => 19
)
*/
?>
Örnek 1: rsort()
<?php
$diziler = array("Breaking Bad","Game of Thrones","Nikita");
rsort($diziler);
print_r($diziler);
/* Sıralı Çıktı
Array
(
[0] => Nikita
[1] => Game of Thrones
[2] => Breaking Bad
)
*/
?>
Örnek 2: rsort()
<?php
$sayilar = array(5,11,9,19,2);
rsort($sayilar);
print_r($sayilar);
/* Sıralı Çıktı
Array
(
[0] => 19
[1] => 11
[2] => 9
[3] => 5
[4] => 2
)
*/
?>
Örnek: asort()
<?php
$yas = array("Hakan"=>"25","Onur"=>"30","Merve"=>"26");
asort($yas);
foreach($yas as $isim => $deger){
echo "Anahtar=$isim, Yaş=$deger <br>";
}
/* Sıralı Çıktı
Anahtar=Hakan, Yaş=25
Anahtar=Merve, Yaş=26
Anahtar=Onur, Yaş=30
*/
?>
Örnek: arsort()
<?php
$yas = array("Hakan"=>"25","Onur"=>"30","Merve"=>"26");
arsort($yas);
foreach($yas as $isim => $deger){
echo "Anahtar=$isim, Yaş=$deger<br>";
}
/* Sıralı Çıktı
Anahtar=Onur, Yaş=30
Anahtar=Merve, Yaş=26
Anahtar=Hakan, Yaş=25
*/
?>
Örnek: ksort()
<?php
$yas = array("Hakan"=>"25","Onur"=>"30","Merve"=>"26");
ksort($yas);
foreach($yas as $isim => $deger){
echo "Anahtar=$isim, Yaş=$deger<br>";
}
/* Sıralı Çıktı
Anahtar=Hakan, Yaş=25
Anahtar=Merve, Yaş=26
Anahtar=Onur, Yaş=30
*/
?>
Örnek: krsort()
<?php
$yas = array("Hakan"=>"25","Onur"=>"30","Merve"=>"26");
krsort($yas);
foreach($yas as $isim => $deger){
echo "Anahtar=$isim, Yaş=$deger<br>";
}
/* Sıralı Çıktı
Anahtar=Onur, Yaş=30
Anahtar=Merve, Yaş=26
Anahtar=Hakan, Yaş=25
*/
?>
YORUMLAR