Dylan Junior Member
Posts: 136 Status: Offline Gender: Male Joined:
pmwwwmsnaimxfire | Php class error (29th Mar 08 at 7:06pm UTC) I have an error | | Code: - <?php
- class settings {
- var $cache_dir;
- function __construct($cache_dir = "C:\xampp\htdocs\site2\cache") (
- $this->cache_dir = $cache_dir;
- }
-
- }
- ?>
Theres my class heres the error i'm getting
Quote: Parse error: syntax error, unexpected '(', expecting ';' or '{' in C:\xampp\htdocs\site2\inc\settings.php on line 5
any ideas? | |
|
|
Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Php class error (29th Mar 08 at 7:14pm UTC) | | $this->cache_dir = $cache_dir; $this->$cache_dir = $cache_dir;
isn't it? | |
|
Dylan Junior Member
Posts: 136 Status: Offline Gender: Male Joined:
pmwwwmsnaimxfire | Re: Php class error (29th Mar 08 at 7:16pm UTC) | | I don't beleive so when your updating a variable in a class.
it's not, when calling a variable inside a class you don't need to include the $ | |
|
|
Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Php class error (29th Mar 08 at 9:05pm UTC) | | Line 4 you put a ( at the end, instead of a { | |
|
Dylan Junior Member
Posts: 136 Status: Offline Gender: Male Joined:
pmwwwmsnaimxfire | Re: Php class error (30th Mar 08 at 4:40pm UTC) | | Ok thanks Wrigthy
New problem when I eche cache_dir this is what it returns? C mpp\htdocs\board2\cachesupport
when it should be
C:\xampp\htdocs\board2\cache
so the \is cancling out the x and the a but i dno't know whyt?
i just added a \ before the \xa | |
|
|