01-09-2012, 04:36 PM
|
#2 (permalink)
|
|
The Addict
Join Date: Aug 2008
Posts: 336
Thanks: 8
|
What were you expecting it would show? print_r would only show the properties in an object in this case. which the class doesn't, have a field. try adding a property and you would see the value print with print_r. like this:
PHP Code:
<?phpclass FeildHTML { public $state = 'not set'; //I added this property public function setFeildCheck ($field, $fieldval, $unsetbutton) { $field = array($field); $fieldval = array($fieldval); $label = array_combine ($field, $fieldval); unset($_POST [ $unsetbutton] ); foreach($_POST as $k=> $v) { $ $key = $v; echo $label[ $k]. "=$v<br />"; } $this-> state = 'set'; }}$a = new FeildHTML (); $a-> setFeildCheck('a', 'b', 'c'); print_r($a); ?>//print_r output is this:FeildHTML Object ( [state] => set )
|
|
|
|