creating class in php code example
Example 1: php define class
class Bike {
function Bike() {
$this->type = 'BMX';
}
}
$blackSheep = new Bike();
print $blackSheep->type;
Example 2: php object
$o= new \stdClass();
$o->a = 'new object';
OR
$o = (object) ['a' => 'new object'];
Example 3: php class
var numbers = [10, 20, 30, 40] // sums to 100var sum = 0;for (var i = 0; i < numbers.length; i++) { sum += numbers[i]}