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 | |
class Song { | |
private $duration; | |
private $name; | |
//Getters/Setters | |
function setName( $name ) { | |
return $this->name; | |
} | |
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 | |
$address = array( | |
'name' => 'John Smith', | |
'line1' => '1 Somewhere Road', | |
'line2' => 'Happytown', | |
'region' => 'Somewhere County', | |
'country' => 'United Kingstates' | |
'postcode' => '123 ABC' | |
); |
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 | |
$address = new Address(); | |
$address->name = 'John Smith'; | |
$address->line2 = ... etc | |
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
(1..100).each do |i| | |
print "Fizz" if i % 3 == 0 | |
print "Buzz" if i % 5 == 0 | |
print i.to_s unless i % 3 == 0 or i % 5 == 0 | |
print "\n" | |
end |
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 | |
function render($page, $params = array()) { | |
extract($params); | |
include "{$page}.php"; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel='stylesheet' type='text/css' href='style.css' media='screen' /> | |
<script type='text/javascript' src='jquery.js'></script> | |
<title>Alis Fruity Milkshakes</title> | |
</head> | |
<body> | |
<div id='wrapper'> | |
<div id='header'> |
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
<h3><?= $title ?></h3> | |
<div id='content'> | |
<?= $content ?> | |
</div> |
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 | |
function render_page($page, $params = array(), $layout = 'layout') { | |
extract($params); | |
$__page = "{$page}.php"; | |
include "{$layout}.php"; | |
} |
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 | |
//calling this with the above files (layout.php + page.php) in the working directory | |
render_page('page', array( | |
'title' => "About The Shakes", | |
'content' => "<p>Bringing the boys to the yard since 1976</p>" | |
)); | |
//would then render this => |
OlderNewer