Hello,
I have two approaches for you:
First:
You could store these values in a temporary array and count the items, if there are less than 24, something went wrong!
$tmp_arr = explode($delimiter, $line);
if(count($tmp_arr) < 24) {
print_r($tmp_arr); // gives you a nice output
}
else
{
list($export_date, $application_id, $language_code, $title, $description, $release_notes, $company_url, $suppport_url, $screenshot_url_1, $screenshot_url_2, $screenshot_url_3, $screenshot_url_4, $screenshot_width_height_1, $screenshot_width_height_2, $screenshot_width_height_3, $screenshot_width_height_4,$ipadscreenshot_url_1, $ipadscreenshot_url_2, $ipadscreenshot_url_3, $ipadscreenshot_url_4, $ipadscreenshot_width_height_1, $ipadscreenshot_width_height_2, $ipadscreenshot_width_height_3, $ipadscreenshot_width_height_4 ) = explode($delimiter, $tmp_arr);
}
If you don't like the temporary array, you could count the delimiters (not as good in my opinion)
if(substr_count($line, $delimiter) < 23) {
// less than 24 fields!
print_r(explode($delimiter, $tmp_arr));
}
else
{
// everything alright!
list($export_date, $application_id, $language_code, $title, $description, $release_notes, $company_url, $suppport_url, $screenshot_url_1, $screenshot_url_2, $screenshot_url_3, $screenshot_url_4, $screenshot_width_height_1, $screenshot_width_height_2, $screenshot_width_height_3, $screenshot_width_height_4,$ipadscreenshot_url_1, $ipadscreenshot_url_2, $ipadscreenshot_url_3, $ipadscreenshot_url_4, $ipadscreenshot_width_height_1, $ipadscreenshot_width_height_2, $ipadscreenshot_width_height_3, $ipadscreenshot_width_height_4 ) = explode($delimiter, $line);
}
!Attention! you only have 23 delimiters for 24 fields! ;)
Second Approach:
Since the Undefined Offset issue is just a "Notice" from PHP you could write an error handler which catches the notice.
See:
http://www.codeunit.co.za/2009/09/09/php-how-to-catch-a-script-warning-or-notice/
But this one maybe a little overkill ;)
Best Regards
Simon