Created
June 14, 2017 17:04
-
-
Save mllopart/d50aa90c6edc289ebf8e5ce7fa394a70 to your computer and use it in GitHub Desktop.
Example of an easy class in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Dragonball { | |
public $ballCount = 0; | |
public function iFoundaBall() { | |
if ($this->ballCount < 7) { | |
$this->ballCount++; | |
} else { | |
echo("You can ask your wish!"); | |
$this->ballCount = 0; | |
} | |
echo $this->ballCount; | |
} | |
} | |
$o = new Dragonball(); | |
for ($x = 0; $x <= 8; $x++) { | |
$o->iFoundaBall(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment