Vote count:
0
I am working on a PHP script which i was cleaning up after the code was working. To make code more readable and easy to fix for future, i tried to move all the regularly used variables to constants.
One such variable value was "http://api.io/url/" which i moved to define and assigned to URL_PREFIX
define("URL_PREFIX" , "http://api.io/url/");
define("FILE_PREFIX" , "http://api.io/files/");
This script worked with the changes. However it started failing suddenly, and on debugging i realized, the place where i am calling URL_PREFIX was assigning the value as "URL_PREFIX" instead of "http://api.io/url/"
$apiUrl = URL_PREFIX . "" . $scope; **[FAILS]**
$apiUrl = "http://api.io/url/" . "" . $scope; **[WORKS]**
Am i missing something up here ? Can a PHP Guru suggested what am i doing wrong or missing
asked 13 secs ago
PHP define not setting variable value
Aucun commentaire:
Enregistrer un commentaire