Serge,
I'm pretty much new to PHP too (I started programming about 2-3 months ago). PHP is a very good language and now I know a lot of it. :-)
Anyway, here is a fixed version of your code. It should work fine.
<?php
session_start();
session_register('SESSION');
if(!isset($SESSION)) {
$SESSION ['count'] = 0;
echo "Counter initialized";
}
else {
echo "session $PHPSESSID";
$SESSION['count']++;
echo "The counter is now {$SESSION['count']}";
}
?>
You did a couple things wrong in your code.
1) In the statement echo "<i> The counter is now $SESSION[count] "; you did not print the array out properly. In PHP, you have to use the {} things to get array values. Also, count must be inside double or single quotes. I used single quotes otherwise they will mess up the double quotes used by the echo function.
Basically that was the only major error. The next error was when you said $SESSION[count]++;. I would recomment putting the count part in single quotes. I don't think it's necessary but it helps other beginner programmers understand that count is not a variable but actually a string which you use to access a part of the array. If you know C, then you would realize that saying just count in C means that count is being used as a variable. Although that is NOT true in PHP, beginner programmers may be mislead when reading your code.
Anyway, good luck and hope this helps!
-Sridhar