| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Member | I have a variable $my_var and I want to pass it in the function Disp(). What is the way to do it? <?php class Page { public function __set($name, $value) { $this->$name=$value; } public function Disp() { echo "My first Page" ; } } ?> <?php $my_var = 'this is a msg' ; // I want to pass this variable in function Disp() class NextPage extends Page { public function Disp() { echo $my_var ; // I want to pass the variable $my_var here } } $np = new NextPage(); $np->Disp(); ?> |
| |
| | #2 (permalink) |
| Barru. | PHP Code:
__________________ |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |