Hi everyone,
I have been experimenting with defining functions as constants.
Below is what I am using to test "Function Constants":

<pre>
<?
define(LOGIN,"user");
define(PASS,"pass");
define(DB,"mysql");

define(DBLOGIN,dblogin(LOGIN,PASS,DB));
DBLOGIN;
$set = mysql_query("Select user FROM user limit 1,1");
$results = mysql_fetch_array($set);
echo "Results: ",$results["user"];

define(DBLOGIN,dblogin("user","incorrect_pass",DB));
DBLOGIN;
//Should print error

$set = mysql_query("Select user FROM user limit 1,1");
$results = mysql_fetch_array($set);
echo "Results: ",$results["user"];


function dblogin($login,$pass,$db) { $mysql = mysql_connect("localhost",$login,$pass); mysql_select_db($db,$mysql); } ?> </pre>

I would like to know what the right term for this kind of constant since a search for "function constants" php
did not return any relevant results.
I would also like to know why I was able to redefine DBLOGIN, I always thought redefining constants could
not be done.


Thanks in advance.
-gohaku

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to