Skip to content

Instantly share code, notes, and snippets.

@tomnomnom
Created June 18, 2012 13:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomnomnom/2948470 to your computer and use it in GitHub Desktop.
Save tomnomnom/2948470 to your computer and use it in GitHub Desktop.
Very Simple MVC
<?php
// "M"
function getUsers(){
// Fetch from DB
// ...
return $arrayOfUsers;
}
// "C"
$users = array();
if (userIsAuthorised()){
$users = getUsers();
}
// "V"
?>
<ul>
<?php foreach($users as $user): ?>
<li><?php echo htmlentities($user, ENT_QUOTES, 'UTF-8'); ?></li>
<?php endforeach; ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment