Hi im new to php and trying to write my first class (im experienced with c++ so im fine with classes) but upon making my first class i started using the pointer reference command “->” for example myClass->printStuff(); but this wouldnt work (ill show all my code below) so i tried a direct copy off of php.net’s simple example and the same issue occured.
i have managed to find the cause but i have searched and searched and cant find anything even remotely about this problem let alone how to fix it.
my code:
[php]<?php
class tester {
private $testingSomething;
function __construct($testing)
{
echo $testing;
$testingSomething = $testing;
}
public function PrintIt()
{
echo "something true";
}
}
$thing = new tester("Something");
$thing->PrintIt();
?>
[/php]
Result:" PrintIt(); ?> "
php.net’s code: (also didnt work)
[php]
[/php]
Result: " foo(); // Note: the next line will issue a warning if E_STRICT is enabled. A::foo(); $b = new B(); $b->bar(); // Note: the next line will issue a warning if E_STRICT is enabled. B::bar(); ?> "
I can tell the issue is when using “->” its treating the “>” symbol as a php code escape but its not one. i tried the obvious but silly idea of doing “->” instead but it didnt work. im guessing this is a php settings issue on my web server but being new to php i don’t have a clue were to look and what setting this might be called.
sorry if this is a simple “newbie” question that should be obvious but i honestly couldn’t find any references to this problem after searching every terminology i could think of to describe the problem.
my web server runs php 5.2.14 and is pre-installed on my nas(QNAP 509 pro latest firmware) im not sure i can update it myself (im pretty sure i cant)
Thanks in advanced for any help