It's nothing to do with it being in a class - that's what you get if you 
echo an array. Try this instead:

echo "init action:";
print_r ($this->$action);

PT

Patrick Newberry wrote:
> I'm trying to use classes rather than a function oriented approach but
> obviously still learning. I pulled out the the not needed for this
> example code:
> 
>  
> 
>  
> 
>  
> 
>  
> 
> class UpdateLastMaint {
> 
>             
> 
>             var $myKey = 0;
> 
>             var $action = "Add";
> 
>             
> 
>             
> 
>             function UpdateLastMaint($key,$action){
> 
>                 $this->$myKey =$key;
> 
>                $this->$action=$action;
> 
>                echo "init action:".$this->$action;
> 
>          }
> 
>                        
> 
>          function GetAfter($key,$user_name) {  
> 
>               echo "action is :".$this->$action
> 
>           }          
> 
>                                     
> 
> }
> 
>  
> 
> Here I call the class
> 
>  
> 
> $LastMaintInfo=new UpdateLastMaint($item_id,"update");
> 
> $LastMaintInfo->GetAfter($item_id,$user_name);
> 
>  
> 
> The output on the screen is :
> 
>  
> 
> init action:update
> 
> 
> action is :Array 
> 
>  
> 
> as you can see when I try to reference $this->action I am getting the
> words Array. 
> 
>  
> 
>  
> 
> What am I doing wrong to not  be able to access the value of $action
> when I use it in a function within the class?
> 
>  
> 
> Pat Newberry
> 
> www.gypsyfarm.com
> 
> 
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> The php_mysql group is dedicated to learn more about the PHP/MySQL web 
> database possibilities through group learning.  
> Yahoo! Groups Links
> 
> 
> 
> 

Reply via email to