replace PHP sizeof() with either count() or empty()

This commit is contained in:
marc tobias
2018-03-22 12:36:24 +01:00
parent d79a2bb17e
commit 27bc8d4f7b
19 changed files with 75 additions and 68 deletions

View File

@@ -2,7 +2,7 @@
$aFilteredPlaces = array();
if (!sizeof($aPlace)) {
if (empty($aPlace)) {
if (isset($sError))
$aFilteredPlaces['error'] = $sError;
else $aFilteredPlaces['error'] = 'Unable to geocode';

View File

@@ -11,7 +11,7 @@ echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.ope
echo " querystring='".htmlspecialchars($_SERVER['QUERY_STRING'], ENT_QUOTES)."'";
echo ">\n";
if (!sizeof($aPlace)) {
if (empty($aPlace)) {
if (isset($sError))
echo "<error>$sError</error>";
else echo '<error>Unable to geocode</error>';

View File

@@ -199,7 +199,7 @@
}
}
if (sizeof($aParentOfLines))
if (!empty($aParentOfLines))
{
headline('Parent Of');
@@ -223,7 +223,7 @@
_one_row($aAddressLine);
}
}
if (sizeof($aParentOfLines) >= 500) {
if (count($aParentOfLines) >= 500) {
echo '<p>There are more child objects which are not shown.</p>';
}
}

View File

@@ -49,7 +49,7 @@ foreach ($aBatchResults as $aSearchResults) {
$aPlace['icon'] = $aPointDetails['icon'];
}
if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])>0) {
if (isset($aPointDetails['address']) && !empty($aPointDetails['address'])) {
$aPlace['address'] = $aPointDetails['address'];
}

View File

@@ -57,7 +57,7 @@
echo '</div>';
$i = $i+1;
}
if (sizeof($aSearchResults) && $sMoreURL)
if (!empty($aSearchResults) && $sMoreURL)
{
echo '<div class="more"><a class="btn btn-primary" href="'.htmlentities($sMoreURL).'">Search for more results</a></div>';
}

View File

@@ -43,7 +43,7 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
$aPlace['icon'] = $aPointDetails['icon'];
}
if (isset($aPointDetails['address']) && sizeof($aPointDetails['address'])) {
if (isset($aPointDetails['address']) && !empty($aPointDetails['address'])) {
$aPlace['address'] = $aPointDetails['address'];
}