xao Posted March 7, 2011 Share Posted March 7, 2011 I don`t get it, waht is wrong?! <?php require_once 'auth.php'; if (!isset($_SESSION['SESS_VERIFY'])) { header("location: access-denied.php"); exit(); } if ($_SESSION['lang'] == 'Ro') { // setare data romania date_default_timezone_set('Europe/Bucharest'); $today = getdate(); $zi = $today['mday']; $luna = $today['mon']; $lunastring = $today['month']; $an = $today['year']; $data = $zi.$luna.$an; $data = (string)$data; $ora = date('H:i:s'); $msg = array(); $err = array(); $luni = array ( 1=>'Ianuarie', 2=>'Februarie', 3=>'Martie', 4=>'Aprilie', 5=>'Mai', 6=>'Iunie', 7=>'Iulie', 8=>'August', 9=>'Septembrie', 10=>'Octobrie', 11=>'Noiembrie', 12=>'Decembrie'); // comun const SQL_ERR = 'SQL statement failed with error: '; const ADD_MODEL = 'ADAUGA UN MODEL NOU'; . .many constants.. . } elseif ($_SESSION['lang'] == 'It') {... Thank you! Link to comment https://forums.phpfreaks.com/topic/229894-strange-parse-error-syntax-error-unexpected-t_const-in-blabla-line-41/ Share on other sites More sharing options...
Pikachu2000 Posted March 7, 2011 Share Posted March 7, 2011 Constants are defined with define(). Link to comment https://forums.phpfreaks.com/topic/229894-strange-parse-error-syntax-error-unexpected-t_const-in-blabla-line-41/#findComment-1184093 Share on other sites More sharing options...
xao Posted March 7, 2011 Author Share Posted March 7, 2011 Strange because before adding if ($_SESSION['lang'] == 'Ro') {} it was ok! so now should I go with define("SQL_ERR","SQL statement failed with error: "); ? Link to comment https://forums.phpfreaks.com/topic/229894-strange-parse-error-syntax-error-unexpected-t_const-in-blabla-line-41/#findComment-1184094 Share on other sites More sharing options...
Pikachu2000 Posted March 7, 2011 Share Posted March 7, 2011 define() is used in the global scope, and const would be used within a class. Link to comment https://forums.phpfreaks.com/topic/229894-strange-parse-error-syntax-error-unexpected-t_const-in-blabla-line-41/#findComment-1184097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.