   Strange PHP function return values...
  I'm getting some very strange return values from the "Get" function below. Most everything you may need is posted below...   class twSettings {var $basicconfig;var $userconfig;  // Implement at later datefunction twSettings() {// Load Basic Configuration$tmp = array_slice( file('./wikiconf/config.txt'), 0, 15 );for ( $n=0; $n < 15; $n++ )$tmp[$n] = trim( $tmp[$n] );$this->$basicconfig = array( 'TWIKI_LOGO'   => $tmp[0],'RILOGO_IMAGE' => $tmp[1],'RILOGO_LINK'  => $tmp[2],'BG_IMAGE'=> $tmp[3],'BG_COLOR'=> $tmp[4],'TEXT_COLOR'   => $tmp[5],'LINK_COLOR'   => $tmp[6],'VLINK_COLOR'  => $tmp[7],'ALINK_COLOR'  => $tmp[8],'TH_IMAGE'  => $tmp[9],'TH_COLOR'  => $tmp[10],'TH2_IMAGE' => $tmp[11],'TH2_COLOR' => $tmp[12],'TR_IMAGE'  => $tmp[13],'TR_COLOR'  => $tmp[14] );print_r( $tmp ); // Output belowprint_r( $this->$basicconfig ); // Output below}function Get( $name ) {// print '{{$name = ' . $this->$basicconfig[$name] . '}} ';if ( isset( $this->$userconfig[$name] ) )return $this->$userconfig[$name];return $this->$basicconfig[$name];}function Has( $name ) {return ( isset($this->$userconfig[$name]) || isset($this->$basicconfig[$name]) );}}The Output from the print_r statements...Array(    [0] => wikiconf/twiki_title.png    [1] => wikiconf/apache_pb.gif    [2] => http://www.apache.org    [3] => wikiconf/bg/bg.gif    [4] => #EEFFFF    [5] => #000000    [6] => #0000DD    [7] => #880088    [8] => #FF0000    [9] =>[10] => #DDDDFF    [11] =>[12] => #DDEEFF    [13] =>[14] => #DDFFFF)Array(    [TWIKI_LOGO] => wikiconf/twiki_title.png    [RILOGO_IMAGE] => wikiconf/apache_pb.gif    [RILOGO_LINK] => http://www.apache.org    [BG_IMAGE] => wikiconf/bg/bg.gif    [BG_COLOR] => #EEFFFF    [TEXT_COLOR] => #000000    [LINK_COLOR] => #0000DD    [VLINK_COLOR] => #880088    [ALINK_COLOR] => #FF0000    [TH_IMAGE] =>[TH_COLOR] => #DDDDFF    [TH2_IMAGE] =>[TH2_COLOR] => #DDEEFF    [TR_IMAGE] =>[TR_COLOR] => #DDFFFF)Now, when I call the "Get" function, like in the code below, I get a very strange return value... print '<HTML><BODY ';if ( $g_Settings->Has('BG_IMAGE') )print 'BACKGROUND="' . $g_Settings->Get('BG_IMAGE');elseprint 'BGCOLOR="' . $g_Settings->Get('BG_COLOR');print '" TEXT="' . $g_Settings->Get('TEXT_COLOR');print '" LINK="' . $g_Settings->Get('LINK_COLOR');print '" VLINK="' . $g_Settings->Get('VLINK_COLOR');print '" ALINK="' . $g_Settings->Get('ALINK_COLOR');print '">'; // End BODY tagThe HTML output from this code:   <HTML><BODY BACKGROUND="Array" TEXT="Array" LINK="Array" VLINK="Array" ALINK="Array">$g_Settings is a valid instance of twSettings... so what isn't working?Many thanks in advance![edited by - Wyrframe on August 3, 2003 5:51:54 PM]
  Something I almost forgot; I''ve tried commenting out the "if ( isset( $this->$userconfig[$name] ) ) ..." bit in Get(). It is definitely not the source of the problem. ;  Well, $this->$basicconfig is syntactically incorrect.You don''t need the second $ sign.$this->basicconfig will work. ;  I can't reproduce the issue.  Which version of PHP are you using?  I'm using 4.3.2.  I created the following file based on what you posted (I did remove the extra $'s): <?phpclass twSettings{  var $basicconfig;  var $userconfig;  // Implement at later date    function twSettings()   {  // Load Basic Configuration    for ( $n=0; $n < 15; $n++ )    $tmp[$n] = sprintf("TestValue%u",$n);  $this->basicconfig = array('TWIKI_LOGO'   => $tmp[0],'RILOGO_IMAGE' => $tmp[1],'RILOGO_LINK'  => $tmp[2],'BG_IMAGE'=> $tmp[3],'BG_COLOR'=> $tmp[4],'TEXT_COLOR'   => $tmp[5],'LINK_COLOR'   => $tmp[6],'VLINK_COLOR'  => $tmp[7],'ALINK_COLOR'  => $tmp[8],'TH_IMAGE'  => $tmp[9],'TH_COLOR'  => $tmp[10],'TH2_IMAGE' => $tmp[11],'TH2_COLOR' => $tmp[12],'TR_IMAGE'  => $tmp[13],'TR_COLOR'  => $tmp[14] );//print_r( $tmp ); // Output below//print_r( $this->basicconfig ); // Output below  }  function Get( $name )   {// print '{{$name = ' . $this->$basicconfig[$name] . '}} ';if ( isset( $this->userconfig[$name] ) )  return $this->userconfig[$name];return $this->basicconfig[$name];  }  function Has( $name )   {return ( isset($this->userconfig[$name]) || isset($this->basicconfig[$name]) );  }}$g_Settings = new twSettings;print '<HTML><BODY ';if ( $g_Settings->Has('BG_IMAGE') )  print 'BACKGROUND="' . $g_Settings->Get('BG_IMAGE');else  print 'BGCOLOR="' . $g_Settings->Get('BG_COLOR');  print '" TEXT="' . $g_Settings->Get('TEXT_COLOR');print '" LINK="' . $g_Settings->Get('LINK_COLOR');print '" VLINK="' . $g_Settings->Get('VLINK_COLOR');print '" ALINK="' . $g_Settings->Get('ALINK_COLOR');print '">'; // End BODY tag?>  And this was the output: <HTML><BODY BACKGROUND="TestValue3" TEXT="TestValue5" LINK="TestValue6" VLINK="TestValue7" ALINK="TestValue8">  Seems to have worked fine.    [edited by - Solo on August 3, 2003 11:13:35 PM];  UfoZ: Many thanks; I hadn''t realized that was syntactically incorrect. I''ll make the changes.Solo: I''m using 4.3.2 as well, with Apache 1.3.27. If the code you tried works, then it will for me, too... thanks! 