I'm trying to export some classes into a library to keep my code tidy but I just don't know why this doesnt seem to work :( the include file is definitely being loaded. when I defined the class locally there was also no problem and testgerät was sent.
I always try to keep things simple at first so I'm using this small sample: Gerät.php:
<?php
echo "loading Gerät<br>";
class Gerät{
function Gerät(){
$this->name = "testgerät";
}
}
?>
index.php
<?php
include "/var/www/html/aiberry/objects/Gerät.php";
echo "My first PHP script!<br>";
$test = new Gerät();
echo $test->name;
?>
the output of index.php
loading Ger�t
My first PHP script!
could this be a namespace issue?
EDIT: I'm sorry for causing confusion regarding the actual issue: I am in fact expecting the output:
loading Ger�t
My first PHP script!
testgerät
If I knew how to turn the debugs on I would probably get a message telling me that there is no class "Gerät". The paradox for me though is that Gerät.php is definitely being loaded because the output "loading Gerät" is written within that file. a simple copy paste of the class into index.php delivers the desired output so i can only think of a name space issue or something alike where the class is just being lost after Gerät.php is done processing.
My first PHP script!
testgerät. Only difference is I changed the include path to be relative to index.php for me. https://github.com/davethomas11/so40075295 . Original poster when you return please add more information to this question, outlining what the issue is. Also if anyone reading this is running Ubuntu 16 please run this and post your findings. – Dave Thomas Oct 16 '16 at 22:25