Jump to content

Hey again, this time I need help function with global vars.


ShaKeD

Recommended Posts

Hey, I`v a problem. I`m using include function.

 

include 'lang.php';

 

now I want to use all of the variables that exist in lang.php ..

the problem is that I`m using functions on my index.php file, and I don't want to enter the function every time with those variables.

 

how can I fix it?

 

 

10x.

Make the variables in the lang.php constants.

 

IE:

 

//lang.php

<?php
// insetad of
$my_welcome_text = "Welcome Home!";

//use
define('MY_WELCOME_TEXT', 'Welcome Home!');
?>

 

That way it is available to every function, class etc as long as it is included.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.