LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-29-2005, 03:03 AM   #1
oberon-ken-obi
LQ Newbie
 
Registered: Jul 2004
Location: Oberon Australia
Distribution: Fedora Core3
Posts: 26

Rep: Reputation: 15
PHP3 & PHP4 Differences?


Hi all

I'll be as succinct as possible.

I have a PHP3 book called "Professional PHP Programming" by Wrox Publishing www.wrox.com . Seems to be very extensive and cost me a packet so I am loath to just stop using it.

Now I am aware of a few differences ie in PHP4 you need to call form variables with $_REQUEST["variable"] or $_POST etc instead of just $variable in PHP3.
This seemed straight forward enough, so I just got on with it and did more examples. The fact I had to change these things seemed to grant a greater understanding so it was all good.

Now the further I go I find many more inconsistancies, ie no boolean variable type in php3 but php4 seems (in my limited understanding) to be recognizing them, at least the isset() function as the example uses (taken directly from the book) does not work correctly.

Code:
<?php  
$avail = isset($avail);     // Convert to Bool 
 echo ($_POST["avail"]); // Prints 1 if checked 
                                       // Prints 0 if unchecked 
?>
This prints "on" and not "1" if check box is selected but fails if not checked.

Escaping certain characters seems different as well. I could make a few more examples but you get the drift im sure.

Directives in php conf file are default for security/speed as suggested by php readme.txt.

I guess what I'm asking is will it be worthwhile to continue as I am, or will I just confuse myself further? Especially anyone who has used this particular book who migrated from ver3 to ver4.

Any suggestions for a ver4 book (if that is what is suggested) would be appreciated as well. Assume I am a novice for the purposes of book selection.
I have seen a book called Sams teach yourself PHP4 in 24 Hours. Seems to good to be true, thoughts on this book please.

Regards
Allan
 
Old 03-29-2005, 04:53 PM   #2
clausi
Member
 
Registered: Mar 2004
Distribution: Debian
Posts: 48

Rep: Reputation: 15
I'd say, wait a while to get a proper PHP5 book because there have been several changes that make it worthwhile (the new OOP stuff, for example). Or just use this amazing tutorial, ehm, online book.


The PHP manual explains PHP3 to PHP4 changes. In general, the manual is really great resource.
 
Old 03-29-2005, 05:19 PM   #3
oberon-ken-obi
LQ Newbie
 
Registered: Jul 2004
Location: Oberon Australia
Distribution: Fedora Core3
Posts: 26

Original Poster
Rep: Reputation: 15
Hey clausi

Thanks for the answer, it is almost exactly what I was asking :+)
Changes link was very helpful too.
Now, if I wait for the PHP5 books will I need to use PHP5 engine as well?
Untill then I will look into the amazing tutorial.
But for now its...
Hi Ho, Hi Ho, its off to work we go.

Regards
Allan
 
Old 04-01-2005, 01:12 PM   #4
clausi
Member
 
Registered: Mar 2004
Distribution: Debian
Posts: 48

Rep: Reputation: 15
Quote:
Originally posted by oberon-ken-obi
Now, if I wait for the PHP5 books will I need to use PHP5 engine as well?
Uhm, sorry for the late answer.

I guess you will want to use it after figuring out all the additional functionality of PHP5 (basically better XML support, and much better and faster OOP support).

But to answer your question: Yes, of course you will need it -- at least, if you gonna use the new functions. However, PHP4 code is said to run fine on PHP5.

Unfortunatly, I don't know if the new version is available for your distro; neither Debian nor Ubuntu have packages yet. And finding a shared server with PHP5 is still tricky, also.

So, you better wait until PHP 5.1.* is out before you spend money on a book - I believe, adoption rate will increase when this happens. As I said, the manual should be sufficient meanwhile. And there are lots of interesting tutorials on the web. Just use google.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SElinux & php4 & interbase & apache maxut Linux - Security 0 03-15-2005 04:57 AM
How do I configure php4 & apachee 1.3? walterbyrd Debian 10 08-22-2004 07:34 PM
Apache2 & prefork MPM, PHP4 XTJ7 Linux - Software 6 04-29-2004 02:43 PM
apache && php4 err DaFrEQ Linux - Software 0 01-17-2003 03:39 PM
Apache2 & php4 CyberDrake Linux - Newbie 2 11-25-2002 11:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration