Skip to content

Instantly share code, notes, and snippets.

@rodrei
Created August 17, 2014 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodrei/ed4f033e63495b92648d to your computer and use it in GitHub Desktop.
Save rodrei/ed4f033e63495b92648d to your computer and use it in GitHub Desktop.
<?php
// Model
class Province
{
public $name;
public $id;
public function __construct($name, $id) {
$this->name = $name;
$this->id = $id;
}
public function link() {
return "http://localhost/provinces/" . $this->id;
}
public static get_all() {
$json = Curl();
$provinces = [];
for($i = 0, ) {
$provinces[] = new Province($json[$i]['id'], $json[$i]['nombre']);
}
return $provinces;
}
}
// Controller
$provinces = Province.get_all();
// Vista
for($i = 0;;) {
$province[$i].link();
}
//$province = new Province('Mendoza', 32);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment