ltbaggz Posted November 28, 2006 Share Posted November 28, 2006 quick question, is there anything special that needs to be set in order for classes to be enabled in php? i know this is a stupid question but whenever i try to implement the simplest class in one of my scripts it returns a blank screen. a special place to include the file maybe? I am running PHP Version 4.3.9 which is what was with my linux distribution. i guess i should try to upgrade this. let me know if you guys have any other ideas. if the update is the problem, is there a simple way to update the current php installation? i am running redhat enterprise edition.thanksdrew Link to comment https://forums.phpfreaks.com/topic/28689-php-classes/ Share on other sites More sharing options...
trq Posted November 28, 2006 Share Posted November 28, 2006 No, there is nothing special that needs to be enabled. Also, php4 is perfectly capable of using classes, just a little different to php5.Does this produce any output?[code]<?php class foo { function bar() { echo "this is bar"; } } $f = new foo(); $f->bar();?>[/code] Link to comment https://forums.phpfreaks.com/topic/28689-php-classes/#findComment-131291 Share on other sites More sharing options...
ltbaggz Posted November 28, 2006 Author Share Posted November 28, 2006 yes that worked, it seems the problem is in my declaration of variables. i am trying to declare a private variable and it seems to choke on that.just a simple [code]private $name;[/code]inserted at the top of the class produces no output. Link to comment https://forums.phpfreaks.com/topic/28689-php-classes/#findComment-131304 Share on other sites More sharing options...
trq Posted November 28, 2006 Share Posted November 28, 2006 The property visability features are not avaiable in php4. Link to comment https://forums.phpfreaks.com/topic/28689-php-classes/#findComment-131311 Share on other sites More sharing options...
ltbaggz Posted November 28, 2006 Author Share Posted November 28, 2006 ok well that explains it. like i posted before i have the php installed thatcame with my redhat bundle. do you know if there is a easy way to update to php 5? i would like to be able to use these features. Link to comment https://forums.phpfreaks.com/topic/28689-php-classes/#findComment-131316 Share on other sites More sharing options...
trq Posted November 28, 2006 Share Posted November 28, 2006 Im not sure what package management system redhat uses, havent used it in a long time (Im a Gentoo Linux user), but php is easily enough compiled from source.There are some pretty usefull install instructions in the [url=http://php.net/install]manual[/url], otherwise I might suggest posting your question in a redhat forum. Link to comment https://forums.phpfreaks.com/topic/28689-php-classes/#findComment-131320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.