I have trouble with PHP version 5.0.5. It throws notices
Code: Select all
Notice: Uninitialized string offset: 0Also checking those variables with empty() does not work.
Code: Select all
if (!emtpy ($foo)) {
code here is executed, while it should not.
}Anyone else got these notices with PHP 5.0.5?
I do not have these notices with PHP 5.0.4 or below or PHP 4.xx.
Bad solution: check for strlen() >=1 instead of !empty()
(notices will come anyway)
Sample code not working (last line throws notice):
Code: Select all
function ReplacePlaceholders($text, $gb) {
$gb_indexes = ARRAY ('count', 'date', 'datetime', 'email', 'id', 'ip', 'message', 'name', 'sent_verify', 'time');
foreach ($gb_indexes AS $item) {
if (!isset ($gb[$item])) {
$gb[$item] = '';
}
}
$template = $text;
$template = str_replace("{COUNT}", $gb['count'], $template);
...djot
-