SitePoint Sponsor

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 25 of 69

Thread: PHP4 or PHP5

Hybrid View

  1. #1
    SitePoint Member sadegh's Avatar
    Join Date
    Jul 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP4 or PHP5

    Hi,
    My company wants to begin a project and doesn't know that which is better for its project (php4 or php5). Mentioned project is very big and project time is very little. Php5 is very powerful and supports object oriented programming excellent but it doesn't use usually (Why?). Programmers with php5 can code a UML diagram very good but it is hard in php4 (because php4 doesn't support OOP very good). I think that php5 is useful for web base projects but other programmers in project team don't accept it. They believe that php4 more useful in this project. They say that php5 is hard and need to extra time to learn it and OOP in php4 is sufficient. Php5 has not a stable version and CPanel don't support it completely. Which is better php4 or php5???.
    Last edited by sadegh; Jul 30, 2005 at 13:25.

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cPanel does support PHP 5. I'm using it!

    They are right in that there is a learning curve with PHP 5. If they want to use 4 and are comfy with it, then let them use it...
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No stable version for PHP 5 ?

    I have never hand any problems with PHP 5
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  4. #4
    SitePoint Addict melchiorus's Avatar
    Join Date
    Jun 2004
    Location
    Indiana
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP5 has it's strengths, PHP4 has it's strengths. PHP3 had it's strengths, but you don't see anyone coding in it anymore (well, you do, but they are just crazy). Logically, PHP5 will be better and replace PHP4.

    If your project plans to span the next year or so, go with PHP5, as you are pretty guarenteed what you code will still work next year since PHP4 will be upgraded to PHP5 on all servers. There will be backwards compatability, but I wouldn't rely on it.
    -Melchior (Stephen Craton)

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sadegh
    Php5 has not a stable version
    PHP 5.0.4 is the latest stable version of PHP. As of PHP 4.3.11 ALL updates to the PHP 4 branch will be to fix bugs only. Personally, I don't see PHP4 going much beyond PHP 4.4.1.


    Quote Originally Posted by sadegh
    They say that php5 is hard and need to extra time to learn it and OOP in php4 is sufficient.
    PHP5 is backwards compatible, therefore, you can write using PHP4's OO model and PHP5 will still work as expected. Infact, using OOP in PHP5 in a PHP4 style is easier since you don't have to tediously pass around references (which anyone will tell you can be a headache as of PHP 4.4).

    Even then, I hardly see how PHP5's new OOP model is much of an additional learning curve, there's not much different.

    In short, PHP5 is the latest current version (soon to be PHP 5.1, I can't way ), PHP 4 should now be deemed a "legacy" product by anyone about to start a product. I'd expect it's support lifecycle to come to an abrupt end very soon.

  6. #6
    SitePoint Addict melchiorus's Avatar
    Join Date
    Jun 2004
    Location
    Indiana
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Lazesharp
    PHP 4 should now be deemed a "legacy" product by anyone about to start a product. I'd expect it's support lifecycle to come to an abrupt end very soon.
    Didn't you say it was backwards compatible and wouldn't matter though?
    -Melchior (Stephen Craton)

  7. #7
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Location
    United Kingdom
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's backwards compatible to a point, but not entirely, elements of it's OOP model are different enough that it breaks BC, however, as the core devs will tell you, anything that is well coded for PHP4 will work on PHP5. The BC break will only affect things that "shouldn't work but did in PHP4".

  8. #8
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Ireland
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If they have reasons for PHP4, fair enough. But, just because PHP5 offers x and y, doesn't mean you have to x and y. Sure, there is better OO Model (access modifiers, interfaces, etc), but they are quite optional. If they have a good knowledge of OO programming in PHP4, then they can still develop the same as before, ignoring the myriad of new features.

    Good Luck

  9. #9
    SitePoint Addict
    Join Date
    May 2005
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Devloping in PHP4 at this point is pointless. PHP5 offers everything that PHP4 does, plus:

    * Exceptions
    * public / private / protected methods and variables
    * real static variables
    * class constants
    * destructors
    * the __autoload() magic function, quite possibly the single most useful thing added to php since it was created (ok, not really, but it is pretty frickin' sweet)
    * Objects passed by reference (yay efficiency)
    * A 60% performance improvement (PHP 5.1)
    * Support for MySQL 4.1, including prepared queries. Once you write code using MySQLi you'll never want to go back.
    * Type hinting
    * Reflection
    * tons of added functions that make life easier, like file_put_contents, string_ireplace, etc.
    * All this stuff
    * PHP Data Objects (PDO) for unified database connection architecture (PHP 5.1)
    * Function overloading

    Backwards incompatability is practically non-existant. Check it out for yourself.

    This is going to sound rude, but anyone who is even considering designing a new application in PHP who isn't going to PHP5 is either seriously misinformed, or just plain stupid.

  10. #10
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Etnu
    This is going to sound rude, but anyone who is even considering designing a new application in PHP who isn't going to PHP5 is either seriously misinformed, or just plain stupid.
    Not everyone has the chance to choose platform. PHP 4 is still the standard on most host providers (as far as I have checked) , so if you don't have your own server that you can set up, many are still stuck with PHP 4 wether they like it or not.

  11. #11
    SitePoint Zealot MystaMax's Avatar
    Join Date
    Apr 2003
    Location
    Atlanta
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think PHP5 is better because thats the one being develop as we speak. the language won't get anything but stronger. Only reason why you see alot of PHP4 programmers is b/c thats what is on most hosting servers.

    Now a good question is how many enterprse programmers here code in PHP5? I wonder if its more than PHP4?

    I think the your co-workers should step it up, grab a book, and start learning PHP5. PHP4 will fade sooner or later. Your co-workers need to realize that business doesn't wait for you. You have to keep up with the business.

    You'll wish you had coded the project in PHP5 2-3 yrs from now

  12. #12
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    India
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Go for PHP5.
    It has solid OOP base.

    One should always use the latest version.
    I am sure you are not using Windows 95 when Windows XP is there.

  13. #13
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your project is relatively large there is no doubt: PHP5

    Building large projects without proper OOP is very litte efficent.

  14. #14
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    It all comes down to hosting. If you can code ing PHP5 why not? It is superior. Period. Sure it may have more bugs. However bugs aside, PHP5 is better then PHP4 and its only a matter of time before the bugs are more or less at the same level as PHP4's.
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users

  15. #15
    _ silver trophy ses5909's Avatar
    Join Date
    Jul 2003
    Location
    NoVa
    Posts
    5,466
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    If your server supports it, I would certainly go with PHP5. Just makes sense to go with the latest release.
    Sara

  16. #16
    SitePoint Zealot Quadzoola's Avatar
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP 5.1 is almost out of beta, at that point I imagine a lot more hosts will be supporting it. It seems to me that when php 4.1 came out the user base rose exponentially. So if you have the means currently then go with 5.
    Jeff Busby

  17. #17
    Non-Member
    Join Date
    Jun 2005
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Php5.

  18. #18
    Where's my title at? dreaz's Avatar
    Join Date
    Apr 2004
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What about migrating from PHP4 to PHP5? I really want to do it, but I can't all at once.
    Is there a safe, stable way of running both PHP4 and PHP5 on the same server (apache, on a freeBSD)?

    Also, are you guys still using MySQL with PHP5? What about SQLite? It seem like a pretty good database engine to me. Do you think it would be better for small databases (like 300-600k entries)?

  19. #19
    SitePoint Addict
    Join Date
    May 2005
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dreaz
    What about migrating from PHP4 to PHP5? I really want to do it, but I can't all at once.
    Is there a safe, stable way of running both PHP4 and PHP5 on the same server (apache, on a freeBSD)?

    Also, are you guys still using MySQL with PHP5? What about SQLite? It seem like a pretty good database engine to me. Do you think it would be better for small databases (like 300-600k entries)?
    I'm about 99% sure that you don't use anything in PHP4 that wll not work in PHP5. Just upgrade, and both will work.

  20. #20
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi don't use php5 if your using mysql 4.1. We had php5 but recently had to revert back to 4 because it shut our server down.
    Have a good day.

  21. #21
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's crap...

    What's the information saying php5 killed your server? I've never had a problem with php and mysql, nor have I had issues with php4 & mysql 4.1, or for that matter, php 5 and mysql 4.1

    It sounds more like mis-administration or someone not knowing what they are doing.

    As for which to use, you need to evaluate the market.

    If this is an internal project, and php5 is available, by all means use it.

    However, if this is to be sold commercially, you need to evaluate the current market. PHP 5 is in the minority... PHP 4 took off around 4.1, and we can all hope that happens with 5.1. You need to plan ahead and be prepared... if it's a commercial application to be sold, and you develop in php5, your cutting your market down to a small segment at this point until hosts are willing to bite the bullet and perform the upgrade.
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  22. #22
    Web development Company chrisranjana's Avatar
    Join Date
    Jan 2001
    Location
    chennai , tamil nadu , India
    Posts
    705
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is better to start learning PHP5 now on and once it is widely accepted start coding in PHP5 rather than PHP4
    Chris, Programmer/Developer, Chrisranjana.com
    Chennai, Tamil Nadu, India.
    Php Developers, Ruby on Rails Developers

  23. #23
    PHP/Rails Developer Czaries's Avatar
    Join Date
    May 2004
    Location
    Central USA
    Posts
    806
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your developers are telling you they need abunch of extra time to learn php5 or they won't be able to code for it, they are either feeing you bull for extra money or do not know what they are talking about. As has been said before, you can code in much the same style for php5 as you can in php4.

    Plus, why would you even WANT to start a brand new project on an already outdated (i.e. legacy) code base? It just doesn't make sense. Your programmers should have no problem coding php code for php5. It's really not all that different unless you are gonig to be using some advanced OO code, in which case you should use php5 anyways because it executes OO code much faster (and with more features!) than php4.

    Plain and Simple: It would be a dumb business decision to start a new project on a legacy codebase that support will be discontinued for. Go for php5.

  24. #24
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,741
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since its backward compatible. I don't see why not php5, since everything that worked correctly in 4 should work in 5. It has objects, but you don't actually have to use them(as a matter a fact, I still find functions more useful that objects in programming CMS's, forums, etc).

  25. #25
    SitePoint Member
    Join Date
    Jan 2005
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a shortage of quality PHP5 hosts, most web hosts are still on php4.

    From what I hear, exceptions in php5 are a joke, catching an exception does not stop the php error handler from giving out an error.

    The new OOP features are good if you want to use them, php 5.1 looks good!

    Samson


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •