__construct
Posted: Mon Feb 19, 2007 4:19 pm
Hello, i`m doing some tutorials on OOP in php5 and a simple script like:
will still display "my text" instead of "hello"
I first thought it was still parsed trough php4, so I contacted my hosting helpdesk and told me to add a line to my htaccess file.
the htaccess file now looks like
but it still displays the "my text" instead of "hello".
Is there something wrong with the script or the htaccess config or something else?
Thanks!
Code: Select all
<?php
class TextBox {
var $body_text = "my text";
function __construct($text_in) {
$this->body_text = $text_in;
}
function display() {
echo "<table border=1><tr><td>$this->body_text</td></tr></table>";
}
}
$box = new TextBox("Hello");
$box->display();
?>I first thought it was still parsed trough php4, so I contacted my hosting helpdesk and told me to add a line to my htaccess file.
the htaccess file now looks like
Code: Select all
RewriteEngine on
RewriteRule ^([A-Za-z]+)$ /$1/ [R]
RewriteRule ^([A-Za-z]+)/$ /index.php?module=$1
AddType x-mapp-php5 .php4Is there something wrong with the script or the htaccess config or something else?
Thanks!