- trim: documentation ( source)
<?php
$str = trim('0');
echo $str . "\n";
if ($str) {
echo "option 1: not empty\n";
}
if (strlen($str)) {
echo "option 2: not empty\n";
}
if (!empty($str)) {
echo "option 3: not empty\n";
}
if ($str !== '') {
echo "option 4: not empty\n";
}