b_angelr Posted October 17, 2006 Share Posted October 17, 2006 I got some experienc now in php and was going to rebuild my website using oop, but know i recive an extrange parse error: here is the example code i used:[code]<?php class MySQL{ //comment public $myvar = "mystring"; }?>[/code]And now it says thet i have an unexpected T_STRING on line 4.Somebody understands why these??? Quote Link to comment Share on other sites More sharing options...
trq Posted October 17, 2006 Share Posted October 17, 2006 The visibility keywords (public, private, protected) are not available in php 4. Use [i]var[/i] instead. Quote Link to comment Share on other sites More sharing options...
b_angelr Posted October 17, 2006 Author Share Posted October 17, 2006 darn.... fool me.... thnxs thorpe ;D Quote Link to comment Share on other sites More sharing options...
b_angelr Posted October 18, 2006 Author Share Posted October 18, 2006 Ok now i feel dumb... 3 years of php expirience for nothing.... i got an extrange warning... i declare a viriable as private, i use it in one function when i'm going to use it in a second function it is said that the veriable doesn't exists....an example:[code]<?php class MySQL{ private $foo; function first(){ $foo = mysql_connect(blablabla); } function second(){ mysql_close($foo); //here it sends me the error, it says $foo doesn't exist } }?>[/code]Please can someone help me Quote Link to comment Share on other sites More sharing options...
trq Posted October 18, 2006 Share Posted October 18, 2006 [code=php:0]<?php class MySQL{ private $foo; function first(){ $this->foo = mysql_connect(blablabla); } function second(){ mysql_close($this->foo); //here it sends me the error, it says $foo doesn't exist } }?>[/code] Quote Link to comment Share on other sites More sharing options...
b_angelr Posted October 18, 2006 Author Share Posted October 18, 2006 I wan to be like you when i grow up thorpe :D thanxs..... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.