Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php //php 7.0.8
- class Hello {
- public $var1;
- public $var2;
- function __construct( $x, $y ) {
- $this->var1 = $x;
- $this->var2 = $y;
- }
- function printvar1() {
- echo $this->var1. "\n";
- }
- function retvar1() {
- return $this->var1;
- }
- function printvar2() {
- echo $this->var2. "\n";
- }
- function retvar2() {
- return $this->var2;
- }
- }
- $hello = new Hello( 13, 37 );
- $hello->printvar1();
- $a = $hello->retvar1();
- echo $a. "\n";
- $hello->printvar2();
- $b = $hello->retvar2();
- echo $b. "\n";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement