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
count() fonksiyonu dizilerin eleman sayısını bulmak için kullanılır. Çoğunlukla 1 parametre ile kullanılır ancak multidimensional dizilerin (çok boyutlu) eleman sayısını bulmak için 2. bir parametreye ihtiyaç duyulabilir. Birkaç örnekle count() fonksiyonunun nasıl kullanıldığını açıklayalım.
Syntax
count(array,mode);
array: Zorunludur. Dizi tanımlanmalıdır.
mode: İsteğe bağlıdır. 0 veya 1 değeri alabilir. 0; varsayılan değerdir, yazılması gerekmez. 1; çok boyutlu dizilerde kullanılır ve recursive (tekrarlayan) sayım yapar.
Örnek 1)
<?php
$sayilar = array("bir","iki","üç","dört");
echo count($sayilar); // Çıktı: 4
?>
Örnek 2)
Bu örnekte oyunlar adında 2 boyutlu dizi oluşturuyoruz. İlk indekste Football Manager var ve 2011, 2012, 2013 oyunlarına (elemanlarına) sahip. 2. indekste PES var ve 2012, 2013 oyunlarına sahip. 3. indekste FIFA var ve 2014 oyununa sahip. Kullanılan count() fonksiyonunu ve çıktılarını inceleyerek ne işe yaradığını anlayabilirsiniz.
<?php
$oyunlar=array
(
"Football Manager"=>array
(
"2011",
"2012",
"2013"
),
"PES"=>array
(
"2012",
"2013"
),
"FIFA"=>array
(
"2014"
)
);
echo "Normal sayım: " . count($oyunlar); // Normal sayım: 3
echo "İndeksli sayım: " . count($oyunlar["PES"]); // İndeksli sayım: 2
echo "Recursive sayım: " . count($oyunlar,1); // Recursive sayım: 9
?>
YORUMLAR