jeudi 21 janvier 2016

PHP Variable Rules

I've got a simple question about variables in PHP! How can i make a global final variable? I wanna have few information in a php-file. I've got some functions there who return the information.

<?php

static $titleOfPage = "Opinion";
static $autor = "Daniel";
static $description = "blablabla";
static $keywords = "blablabla";

function getTitleOfPage(){
    return $titleOfPage;
} 
function getAutorOfPage(){
    return $autor;
} 
function getDescriptionOfPage(){
    return $description;
} 
function getKeywordsOfPage(){
    return $keywords;
} 

?>

I include this file in another php file. And there i just wanna get the information from here. So when I do

echo getDescriptionOfPage();

I get the Error= Undefined variable: titleOfPage in /Applicat.... I only know the rules from C and JAVA.. Can anyone help me?

Thank you very much!




Aucun commentaire:

Enregistrer un commentaire