Suppress CRON Errors

I have a page that runs fine. I suppress the Notice errors by doing:
and it works fine.

But when it runs as a CRON the cron report has the errors.
Notice: Undefined offset: 37 in /var/www/vhosts/*.com/httpdocs/page.php on line 89
Notice: Undefined offset: 37 in /var/www/vhosts/*.com/httpdocs/page.php on line 90

Is there a way to suppress errors in CRON reports?
function CSV2Array($contentx, $delim = ',', $encl = '"', $optional = 1) {
   if ($contentx[strlen($contentx)-1]!="r" && $contentx[strlen($contentx)-1]!="n")
       $contentx .= "rn";
   $reg = '/(('.$encl.')'.($optional?'?(?(2)':'(').
   preg_match_all($reg, $contentx, $treffer);
   $linecount = 0;
   for ($i = 0; $i<=count($treffer[3]);$i++) {
       $liste[$linecount][] = $treffer[1][$i]; ////Here is the first Notice Error
       if ($treffer[3][$i] != $delim)////Here is the second Notice Error
   return $liste;

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

how do u call your script in cron ?
did u try to disable errors in php.ini ?
phperAuthor Commented:
I'm using Plesk to run the cron.
/usr/bin/php -f /var/www/vhosts/*.com/httpdocs/page.php

Errors are disabled in php.ini. I forgot, I put ini_set("display_errors","0"); in an effort to suppress the cron errors.
maybe you should use this in line 12
for ($i = 0; $i<count($treffer[3]);$i++) {

seems you are always exceeding arrays offsets
How about supressing using the '@' before what you're doing? I'm not sure, however if this applies only when calling functions, but maybe worth a try:
   for ($i = 0; $i<=count($treffer[3]);$i++) {
       @$liste[$linecount][] = $treffer[1][$i]; ////Here is the first Notice Error
       if (@$treffer[3][$i] != $delim)////Here is the second Notice Error

Open in new window

phperAuthor Commented:
Actually, I found that


stops the error reporting in the CRON report

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.