echo 'VROOOOOOOOMMMMM'; } } class chanceOfRain { public $chance; function __construct() { $this->chance = rand(0, 10); // echo $this->chance; } function checkForRain() { if ($this->chance > 5) { return true; } else { return false; } } } $myCar = new car(); $myCar->accelerate(); $myCar->letsOpenTheTop(); $myNewCar = new bmw(); $myNewCar->accelerate(); // $myNewCar->letsOpenTheTop(); $rain = new chanceOfRain(); if ($rain) { echo "<p>It's raining!</p>"; $myCar->letsCloseTheTop(); }