Hello Peeps,
I need some PHP help! I seem to get some kind of syntactical error, with a class, I have "paraphrased" the code here, and replicated the problem.
The Classfile.
Which is included in this script:
I can't see anything really wrong with this, the biggerthanfive() function works fine as a standalone function, so I think its something to do with the contstructor? Noy only does it throws an error when I run it, but netbeans tells mea there is something wrong too
I'm stumped, I have 2 Internets to give away to someone who can help put me in the right direction!
Many Thanks
Edit: the problem seems to be with the function in the class.
I need some PHP help! I seem to get some kind of syntactical error, with a class, I have "paraphrased" the code here, and replicated the problem.
The Classfile.
PHP:
<?php
class MyClass {
var $number
function biggerthanfive() {
if ($this->number >= 5) {
return (true);
}else{
return (false);
}
}
}
?>
PHP:
<?php
include "newClass.php";
$myclass = new MyClass;
$myclass->number = 8;
$biggerthanfive = $myclass->biggerthanfive();
if(!$biggerthanfive) {
echo "number is lager than 5";
} else {
echo "number is not larger than 5";
}
?>

Many Thanks
Edit: the problem seems to be with the function in the class.