mysqli - Can you define class variables from within a class method in PHP? -



mysqli - Can you define class variables from within a class method in PHP? -

i want pull info file files table, table's construction might change.

so, i'd pull field names table , utilize them generate class variables contain information, store selected info them.

is possible?

sample

<?php class testclass { public $property1; public function method1() { $this->property1 = '1'; $this->property2 = '2'; } } $t = new testclass(); $t->method1(); print( '<pre>' ); print_r( $t ); print( '</pre>' ); ?>

output

testclass object ( [property1] => 1 [property2] => 2 )

as can see, property wasn't defined created assigning using reference $this. yes, can define class variable within class method.

php mysqli

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -