Replace sizeof with count

Do not use sizeof to get the length of an array, as the function name 'sizeof'
is misleading
This commit is contained in:
Matthias Jentsch 2014-06-23 14:17:56 +02:00
parent d199a8b036
commit 010466f8f9
3 changed files with 5 additions and 5 deletions

View File

@ -101,14 +101,14 @@ class Inline {
foreach ($this->data as $key => $value) {
$this->data[$key] = (int)$value;
}
for ($i = 0; $i < sizeof($this->data); $i++) {
for ($i = 0; $i < count($this->data); $i++) {
$this->labels[] = '';
}
if (array_key_exists('colors', $_GET)) {
$this->colors = $this->sanitizeStringArray(explode(',', $_GET['colors']));
}
while (sizeof($this->colors) < sizeof($this->data)) {
while (count($this->colors) < count($this->data)) {
$this->colors[] = '#FEFEFE';
}

View File

@ -101,7 +101,7 @@ class Dns
public static function ipv4($hostname)
{
$records = dns_get_record($hostname, DNS_A);
if ($records !== false && sizeof($records) > 0) {
if ($records !== false && count($records) > 0) {
return $records[0]['ip'];
}
return false;
@ -117,7 +117,7 @@ class Dns
public static function ipv6($hostname)
{
$records = dns_get_record($hostname, DNS_AAAA);
if ($records !== false && sizeof($records) > 0) {
if ($records !== false && count($records) > 0) {
return $records[0]['ip'];
}
return false;

View File

@ -22,7 +22,7 @@ $pivotData = $this->pivot->toArray();
$hostFilter = '(' . implode('|', array_keys($pivotData)) . ')';
?>
<?php if (sizeof($pivotData) === 0): ?>
<?php if (count($pivotData) === 0): ?>
<?= $this->translate('No Service Found'); ?>
<?php endif ?>