Php function's error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
user___
Forum Contributor
Posts: 297
Joined: Tue Dec 05, 2006 3:05 pm

Php function's error

Post by user___ »

Hi guys,
I have a function, which is very simple and I do not know why it does not work.

Code: Select all

function _sample($input_arr = array()) {
$i = 0;
$keys_arr = array_keys($input_arr),;

if(is_array($input_arr) && count($input_arr)>0) {
   foreach($input_arr as $k=>$v) {
   $this->output_arr = array($keys_arr[$i] this->escape_str($v, $get_magic_quotes_state));
   $i++;
   }
}
else {
   $this->output_arr = $input_arr;
   }
}
It does not set $this->output_arr in the class. I mean $this->output_arr is empty while it is not private. I tried it with array_values as it is done above but in a slightly different way and it did not work.
Ahy suggestions?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You have a parse error on the line where output_arr is assigned.
Post Reply