Cole Geissinger
Senior Web Engineer at 10up. PHP, JavaScript, technology, musician and enjoys a good sandwich.
Co-Organizer @ WIMP
Front/Back-end Web Developer
Photographer
Musician
An HTML-embedded server-side scripting language.
<div class="my-content">
<p>I'll put some pretty little text here...</p>
<?php PHP CODE GOES HERE ?>
</div>
<?php echo(); ?>
<?php print(); ?>
<?php echo('Hello, Wimps!'); ?>
<?php echo 'Hello, Wimps!'; ?>
<?php print("Hello, Wimps!"); ?>
<?php print "Hello, Wimps!"; ?>
<?php $variable = 'Mr. Bucket'; ?>
<?php echo $variable; ?>
<?php echo "Hello, $variable"; ?>
<?php $variable = 'Mr. Bucket'; ?>
<?php $variable = "Hello, $world"; ?>
<?php $string = 'What\'s up, Doc?'; ?>
<?php $show = "\"Game of thrones\", FTW"; ?>
<?php
$city = 'Santa Rosa';
$state = 'CA';
$location = $city . $state;
?>
<?php $age = 2500; ?>
<?php
$math = 10 + 20;
$math = $math1 * $math2;
$math = 20 / 10;
?>
<?php
$array = array(
'array_key' => 'array value',
0 => 'array value'
);
$object = (object) array(
'object_key' => 'array value',
0 => 'array value'
);
?>
(oooh, oooh , oh, oooooh!)
<?php
$indexed = array(
0 => 'value here',
1 => 'another value'
);
$associative = array(
'state' => 'CA',
'city' => 'Santa Rosa'
);
?>
<?php echo $indexed[0]; ?>
<?php echo $associative['state']; ?>
<?php echo $object->array_key; ?>
<?php
if ( condition ) {
// Do something!
} elseif ( condition ) {
// Do something else!
} else {
// Our fall back if no condition is met
}
?>
By Cole Geissinger
A little sumpin' sumpin' on the basic of PHP. Of course there is much to learn, and this only just touches the surface. Presentation for WIMP (Web and Interactive Media Professionals) on August 28th, 2013
Senior Web Engineer at 10up. PHP, JavaScript, technology, musician and enjoys a good sandwich.