...

View Full Version : Operator Syntax Question



Clandestine
02-14-2006, 10:36 PM
<?
defined('OK') or die();

/* Carga la configuracion para acceso */
/* Load default login configuration */

return array(
// Nombre del campo usuario / User field name
'login:usuario' => array('sdata','user'),

// Nombre del campo de contraseña / Password field name
'login:contrasinal' => array('sdata','pass'),

// Si la contraseña se recibe ya encriptada o si debemos encriptarla antes
// de realizar la comprobación de login
// If the password it's encripted or if pfn must crypted after check user
// true = it's encripted | false = pfn must crypt
'login:encriptada' => true,

// Metodo para obtener los datos / Method to obtain data
// post | get | session | server
'login:metodo' => 'session'
);
?>

This code is in a file (login.inc.php) included in another file (index.php). "index.php" contains the following code:

<?
$_SESSION['sdata'][] = array(
"user" => "test",
"pass" => md5("test")
);
?>

Can someone tell me what purpose the colon serves between "login" and "usuario"? Or could you just explain what is happening here? What is "login:usuario"? Any way you can answer the question would be helpful.

It is valid as far as syntax goes, because it is used often in the code of PHPfileNavigator (http://pfn.sourceforge.net), but I haven't seen it before now.

Thanks for any help!

Jak-S
02-14-2006, 11:08 PM
The colon dosent mean anything, its just a character in the key for that array element. Basically, if you had code like this:



$test = array('login:name'=>'jack');


That would create a variable called $test, that is any array with one element. Each element has a key (for identifying it in the array), and a value. To access the value of the "login:name" element of the $test array you would do something like this:



print $test['login:name'];


Jack

felgall
02-15-2006, 09:33 PM
label:content or key:value



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum