I’ve got a really wierd problem on my hands…
When I try to require a class of mine everything after the use of => gets printed to the page instead.
There’s really no problem in the code, it worked previously when I initially developed it on a linux machine but now when I try to use it in wamp it doesnt…
So my best guess is that it’s a wamp problem although => works fine in other classes.
I’ll paste the code where this occurs anyway.
index.php:
<?php
require_once('classname.class.php');
Classname::getInstance();
classname.class.php:
<?
class Classname
{
protected static $defSettings = array(
'TITLE' => 'My site'
);
other code...
So when I load the page it prints out:
‘My site’ );other code…
And a fatal error: “Class ‘Classname’ not found in C:\wamp\www\site\index.php on line 4”
What on earth could cause this?
EDIT: solved. Stupid “typo” error.
Every PHP code block MUST be encased with
<?php ... ?>code tags, even if you’re usinginclude()orrequire().Remember, there is no such thing as a “PHP script”. There are only files that contain PHP code blocks. Without the
<?php ... ?>tags, the PHP interpreter will NOT treat the text as code.