I'm pulling out my hair on this. I don't think I'm doing anything wrong and
I've tried it with PHP 4.3.4 (cli) (built: Nov 7 2003 03:47:25) AND also
v4.1.2 on Linux.
With the line commented as shown, I get this output:
------
[daevid=pts/4]6:[EMAIL PROTECTED]:{/home/daevid}> ./test.php
packetArray:
Array
(
[a] => foo
[b] => bar
[c] => 1
[d] => 2
[e] => 3
)
myPacket:
------
How come I don't get ANY array under "myPacket:"?
How come I don't get a "[test] => 2345245" under "myPacket:" when I
explicitly set it?
Uncommenting the 'blah' element causes this error:
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
`T_VAR' or `'}'' in /home/daevid/test.php on line 16
The 'var' keyword seems to be required, or I get that same error also.
I've tried other combinations and can't figure out what I'm doing wrong?
------------------------ snip -----------------
#!/usr/bin/php
<?php
$PACKET = array('a'=>'foo', 'b'=>'bar', 'c'=>'1', 'd'=>'2', 'e'=>'3');
$AP = array();
$ap['11111'] = new kismetap($PACKET);
$ap['11111']->printMyVars();
class kismetap
{
var $myPacket = array();
// $myPacket["blah"] = "asdfasdfasdf";
function kismetap( $packetArray )
{
echo "packetArray:\n";
print_r($packetArray);
$this->myPacket = $packetArray;
$this->myPacket["test"] = 2345245;
global $myPacket;
$myPacket = $packetArray;
} //kismetap::constructor
function printMyVars()
{
echo "myPacket:\n";
print_r($myPacket);
}
} //kismetap class
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php