php - get value from array inside object -


if

var_dump( $poll->vote_form() );   

class method returns array want

array (size=3)   'id' => int 41   'name' => string 'sg' (length=2)   'options' =>      array (size=4)       116 => string 'dsg' (length=3)       117 => string 'dsg' (length=3)       118 => string 'dg' (length=2)       119 => string 'gd' (length=2) 

but when

echo $poll->vote_form['name'];

i error

undefined property: poll::$vote_form

hm seems problem? method of class poll

public function vote_form() {             ...     $form = array('id' => $poll_id, 'name' => $poll_name, 'options' => $poll_options);     return $form; } 

try this

$data=$poll->vote_form(); echo $data['name']; 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -