www.webdeveloper.com
Results 1 to 3 of 3

Thread: PHP4 to PHP5?

  1. #1
    Join Date
    Aug 2007
    Posts
    3

    Cool PHP4 to PHP5?

    I have PHP code that works when I test it locally using PHP4 but gives me errors when I test it on my online server which I believe is using PHP5...

    Structure and problem:

    Header.php includes several .php pages that have classes ex:
    include("inc_form.php");

    and in inc_form.php I have something like:
    class form {
    function form($x){
    blah
    }
    }

    later in the header I have pages that call the class:
    $newform = new form("x");
    ...


    This works on my local machine using PHP4, but in PHP5 it gives the following error:
    Fatal error: Cannot instantiate non-existent class: form

    for where I create the new form. What am I doing wrong?

    Thank you!

  2. #2
    Join Date
    Jun 2006
    Location
    Down at the bottom of the garden
    Posts
    1,239
    Sounds to me like the class was never included on the live server.

    I'm pretty sure PHP5 is backwards compatible with class named function constructors?

    Are you sure the class is being included?
    Quote Originally Posted by temp.user123
    You know... You're not so smart. Do you need me to educate you?
    If you say, "please," (and do so, nicely) then I will show you where you're dead wrong.

  3. #3
    Join Date
    Mar 2004
    Posts
    3,056
    The autoload feature of PHP5 is very handy. I use it on every page.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles