virtualAnon virtualAnon - 3 months ago 10
PHP Question

PHP - Unexpected T_CONST

When I run my codes to my localhost, it is just doing fine, but when I put it on my "webhoster" (000Webhost, The Free Version). The error


Parse error: syntax error, unexpected T_CONST in
/home/a5532550/public_html/login/db-const.php on line 7


just shows up. The server is using PHP version of 5.2. *, Apache version of 2.2.19 (Unix) and MySQL version of 5.1

DB-Const Codes

<?php
const DB_HOST = ------;
const DB_USER = ------;
const DB_PASS = ------;
const DB_NAME = ------;
?>

Answer

Use define instead

define("DB_HOST", "hostname");