Is there a way to make an array with only the key defined? That maybe will
help me.
$area = array('news' => array('admin'));
print_r($area) gives me:
Array ( [corporativo] => Array ( [0] => classificados ) )
The key is '0', I need key 'classificados' without a value, so I can make
this:
function MakePowers ($area, $powers)
{
foreach ($powers as $value) {
$_SESSION[$area] = $value;
}
}
But this gives me ILLEGAL OFFSET error on $_SESISON[$area];
Any help? Again? :-)
--
Julio Nobrega.
Um dia eu chego l�:
http://sourceforge.net/projects/toca
Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
"Julio Nobrega Trabalhando" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi All!
>
> Here's something I am trying to do, and I don't know if it's possible. I
> have a function that must register session variables, values that come
from
> an array. But each of these values will be the value of an session array,
of
> non-fixed size.
>
> Let me explain (w and d stands for Write and Del):
>
> What I need:
> $_SESSION['news']['w'] = 1;
> $_SESSION['news']['d'] = 1;
>
> So what I am doing:
>
> $w = 1;
> $d = 1
> $powers = ($w, $d); // This array can have an undetermined number of
values
>
> function MakePowers ($area, $powers)
> {
> foreach ($powers as $value) {
> $area = $value;
> }
> }
>
> Now here comes the real problem, $area specifies where in the $_SESSION
> array I will store the power.
>
> I did $area = $_SESSION['news'] but gives me a "undefined index 'news".
I
> could define 'news' for each page of my application but that's not much
> function reuse :-)
>
> And $area could be, in different pages, $_SESSION['news]['admin'],
> $_SESSION['forum'], etc...
>
> That's my non-fixed sized array. I need to make a central function that
> will store in different keys of $_SESSION values that say what powers the
> user has, powers that come from the $powers array.
>
>
> ANY help? I hope I did a good job trying to explain what I am trying to
do
> :-)
>
> Many thanks for any help, sincerely!
>
> --
>
> Julio Nobrega.
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php