PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
class php3session {
var $name = PHP_SESSION_NAME;
var $auto_start = false;
var $referer_check = false;
var $save_path = PHP_SESSION_SAVE_PATH;
var $save_handler = 'php3session_files';
var $lifetime = 0;
var $cache_limiter = 'nocache';
var $cache_expire = 180;
var $use_cookies = true;
var $cookie_lifetime = 0;
[color=#FF0000] var $cookie_path = substr(DIR_WS_ADMIN, 0, -1);[/color]
var $cookie_domain = '';
var $gc_probability = 1;
var $gc_maxlifetime = 0;
var $serialize_handler = 'php';
var $ID;
var $nr_open_sessions = 0;
var $mod_name = '';
var $id;
var $delimiter = "\n";
var $delimiter_value = '[==]';
function php3session() {
$this->mod_name = $this->save_handler;
}
}
The substr() function is the issue. I can't call ANY function and set it to the class variable. Seems like it has to be a static variable.
What you wrote is a class not an object. A class is a static type declaration while objects can be dynamic. As jaudestudios mentioned, you perform initializing through the __construct method, which is run whenever a class object is instanced. Also he is correct to point out that the syntax you are using is deprecated since PHP 4. If you are using PHP 5 you are better of using visibility syntax to declare class members. http://www.php.net/zend-engine-2.php