[eluser]searain[/eluser]
Thanks!
Missed that part.
What is the best practice in CI coding?
In developing, we should always make the codes error proof for E_ALL level error reporting? Or just make the codes error proof for "E_ALL & ~E_NOTICE" level error reporting?
My guess is CI wants us to write codes error proof for E_ALL level error reporting. But many codes in CI were not error proof for E_ALL level error reporting, even in developing, the error proof were set up to E_ALL and no error reported.
For example, the codes like this
Code:
<?php
if ($_SESSION['userid'] < 1)
{
echo 'Please log in';
}
else
{
echo 'Hello Friend!';
}
?>
We saw a lot in the CI sample codes. As long as the human developer knows that the $_SESSION['userid'] is already set, the code will be fine or error_reporting E_ALL. But to make the codes human error free for E_ALL error reporting, we need to write like this
Code:
<?php
if (isset($_SESSION['userid']) and ($_SESSION['userid'] < 1))
{
echo 'Please log in';
}
else
{
echo 'Hello Friend!';
}
?>
I didn't see too many codes written this way.
Thanks!