Skip to content

Instantly share code, notes, and snippets.

@cyrilletuzi

cyrilletuzi/accessors.php

Last active Jan 28, 2017
Embed
What would you like to do?
<?php
class User {
private $firstName;
public function getFirstName() {
return $this->firstName;
}
public function setFirstName($newFirstName) {
$this->firstName = $newFirstName;
}
}
$myUser = new User('Henri');
$myUser->getFirstName();
$myUser->setFirstName('New name');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment