Click to See Complete Forum and Search --> : Code outdated?
While reading the WROX book 'Professional PHP Programming', I came across an example where the code is outdated I believe. At the time of writing, the examples are written using PHP3.x.
In a text field named 'user', after the guest types their name and clicks submit, it takes them to a php page with the following code:
<?php echo("Welcome " . $user); ?>
Testing this out using PHP5, I knew it wouldn't work and I had to use
<?php echo("Welcome " . $_POST[user]); ?>
My question is, is this book extremely outdated? Is there going to be a lot of outdated information that would completely mess my programming? Is it still worth reading this book even though it's PHP3? Is there a website that lists all the changes from PHP3 to PHP5?
To get a better idea, you can view the book i'm reading here (http://www.amazon.com/exec/obidos/tg/detail/-/B0000B0T0W/qid=1113107208/sr=8-1/ref=sr_8_xs_ap_i1_xgl14/103-2472510-4524629?v=glance&s=books&n=507846)
HaganeNoKokoro
04-09-2005, 11:45 PM
The likely cause is that your installation of php has register_globals=off in php.ini. register_globals automatically creates variables named after autoglobal entries such as the items in $_GET and $_POST
The book is not out of date, but it does make the assumption (it may assert this assumption somewhere so you are aware of it) that you have register_globals=on
MstrBob
04-09-2005, 11:55 PM
The likely cause is that your installation of php has register_globals=off in php.ini. register_globals automatically creates variables named after autoglobal entries such as the items in $_GET and $_POST
The book is not out of date, but it does make the assumption (it may assert this assumption somewhere so you are aware of it) that you have register_globals=on
Well, from reading the reviews, the book covers PHP 3. In which case I would really recommend going for a more recent book. PHP 4 brought in a vast amount of functions, and I believe changes to the OOP. Zend is starting to shift towards PHP 5, though PHP 4 is still the standard.
I often prefer Registered Globals off, but you'll find that there are numerous differences between the PHP versions. If you look around the PHP manual, you can see it.
http://www.php.net/
I suppose that basic programming ideas still hold true, but I'd recommend looking at a resource then that covers PHP 4 at least, if you don't want to just make the jump to PHP 5.
HaganeNoKokoro
04-10-2005, 12:05 AM
I didn't mean to say the book wasn't out of date, rather that out-of-date-ness wasn't really the cause of the problem in this case.
spufi
04-10-2005, 12:15 AM
I didn't mean to say the book wasn't out of date, rather that out-of-date-ness wasn't really the cause of the problem in this case.
And if you do a search for the book on their site, that version doesn't come up, so you can't even get errata for it anymore.
I actually managed to get the eBook version of it. I would not purchase a PHP3 book. I do have the O'Reilly PHP programming book by Rasmus Lerdof but I've always been a big fan of WROX books.
Stephen Philbin
04-10-2005, 09:01 AM
Personally I just stick with www.zend.com
It's rather yummy. :D
spufi
04-10-2005, 10:46 AM
I've always been a big fan of WROX books.
Ditto. I'm luke warm on O'Reilly. You could also check out Site Point's books. Their intro PHP/MySQL book is good besides not including a couple very important pieces of code that you need to really make the application you build work. I am getting good use out of the anthology books though.
Ditto. I'm luke warm on O'Reilly. You could also check out Site Point's books. Their intro PHP/MySQL book is good besides not including a couple very important pieces of code that you need to really make the application you build work. I am getting good use out of the anthology books though.
Well I just happened to get my hands on a few of these *.pdf eBooks. Someone must have photocopied them :D . To be honest I have never read any O'Reilly books so I will 'not judge the book by its cover' :p . I have not checked out www.zend.com so I will check it out. I guess what I will do is I will try to learn from the o'reilly, wrox, php.net and zend.com all together :eek:
ShrineDesigns
04-10-2005, 04:56 PM
PHP 3 by default used register_globals = On, while in later version register_globals = Off.
it is best to code around register_globals turned off, it makes the scripts you write, readable
not to mention the vast security holes register_globals = On causes