Created
January 24, 2018 11:53
-
-
Save hemikak/561fd909a6dc8b62fb58759ab56ce1ff to your computer and use it in GitHub Desktop.
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 | |
echo "Arrays" . "\xA"; | |
// Arrays | |
$cars = array("Volvo","BMW","Toyota"); | |
$cars2 = array("Volvo","BMW","Toyota"); | |
$cars3 = array("Nissan","e","8"); | |
var_dump($cars === $cars); | |
var_dump($cars === $cars2); | |
var_dump($cars === $cars3); | |
echo "\xA" . "Objects" . "\xA"; | |
// Objects | |
class Car { | |
function Car($model) { | |
$this->model = $model; | |
} | |
} | |
// create an object | |
$herbie = new Car("VW"); | |
$herbie2 = new Car("VW"); | |
$toyota = new Car("TY"); | |
// show object properties | |
var_dump($herbie === $herbie); | |
var_dump($herbie === $herbie2); | |
var_dump($herbie === $toyota); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: