SlideShare a Scribd company logo
Intro To Server Side Programming 
Lesson Three
Recap - What Have We Found? 
• Literals 
• boolean - True/False 
• integer 
• float - decimal numbers 
• string - text 
• array - ordered key/value pairs 
• object - literal within class 
• Null - no value
Recap Continued 
• Operators 
• Arithmetic - $newvalue = $oldvalue + 1; 
• Assignment - $newervalue = 10; 
• Comparison - $newvalue != $oldvalue; 
• String Operators 
var_dump('foo' . 'bar'); 
$a = 'foo'; a .= 'bar'; 
var_dump($a);
Order of Operations 
• PHP (and most languages) follows Operator Precedence 
rules 
• These allow for unambiguous statements 
• Parentheses can be used to override default Operator 
Precedence or to add visual clarity 
$taxable_income = $wages + $earnings - $deductions; 
$taxable_income = $wages + ( $earnings - $deductions );
Programming Blocks 
• Blocks are sections of code grouped together 
• Blocks consist of declarations and statements 
• PHP organizes statements into blocks with { } 
• Conventions dictate indentation for readability 
{$foo=$bar+$bat;echo $foo;} 
{ 
$foo = $bar + $bat; 
echo $foo; 
}
Coding Conventions 
• A set of guidelines for a specific programming language of 
recommended styles, practices & methods for each 
aspect of a program 
• Covers things like file organization, indentation, 
comments, declarations, statements, white space, 
naming conventions, practices & principles 
• This improves the readability of code and makes software 
maintenance easier. 
• Conventions enforced by humans, not compilers
Ease of Reading/Ease of Use 
• $UP=6;DN=19;$x=0; 
while(++$x<=24){echo "hour $x: "; if($x>+$UP&&$X<+$DN); 
echo "sun is up"; else echo "sun is down": echo "n"; } 
• define( 'SUNRISE', 6 ); 
define( 'SUNSET', 19 ); 
$hours = range( 1, 24); 
foreach ( $hours as $hour ) { 
// ternary operation 
$up_or_down = ( ( 
$hour >= SUNRISE and 
$hour <= SUNSET 
) ? 'up' : 'down' ); 
echo "hour {$hour}: ", 
"sun is {$up_or_down}", 
"n"; 
}
Assignment 3.1 
Good Code, Bad Code
Good Code, Bad Code 
• Log in to Github 
• Look through your forked projects for a block (~100) lines of 
code that are either very hard or very easy to read based on 
the coding style 
• Copy & paste into a file named assignment-3.1.md 
• Make a list with your partner of ways that the code style could 
be improved in each of your examples 
• Save files to share with the class. Push to Github? (https:// 
help.github.com/articles/create-a-repo)
Git and Github - Here to Help 
• Git is your robot friend that remembers what you tell it to remember, 
and only that 
• This robot recognizes when things have changed 
• It knows how to remember, just not when 
• Git can tell you what changed and when, you use comments to tell it 
(and yourself) why 
• If you ask nicely (-h or --help) the robot will help 
• This robot is well organized and can track branches of changed 
code
Basic git Commands 
• git branch - what branches are there & which am I on? 
• git status - what files have I changed or created? 
• git add (files) - consider this stuff for remembering 
• git commit (files) - I really want you to remember what I've considered via git add 
• git push [remote [branch] ] - tell the robot named "remote" (default is "origin") about 
my changes in "branch" (default is "master") 
• git fetch [remote] - ask the robot named "remote" for changes or branches that you 
don't know about yet 
• git merge [branch] - attempt to combine changes in "branch"

More Related Content

PPTX
Web Application Development using PHP Chapter 3
PDF
ElePHPant7 - Introduction to PHP7
PPTX
Php server variables
PPTX
Php functions
PPTX
Php pattern matching
ODP
HTML Templates Using Clear Silver
PPT
php 2 Function creating, calling, PHP built-in function
PPTX
Php Intermediate
Web Application Development using PHP Chapter 3
ElePHPant7 - Introduction to PHP7
Php server variables
Php functions
Php pattern matching
HTML Templates Using Clear Silver
php 2 Function creating, calling, PHP built-in function
Php Intermediate

What's hot (20)

PPT
Xslate sv perl-2013-7-11
PDF
4.2 PHP Function
PPTX
Working with WP_Query in WordPress
PDF
DIG1108 Lesson 6
PDF
Developing applications for performance
PPTX
PHP for hacks
PPT
Introduction To Lamp
PPTX
Introduction in php
PDF
PHP 5.4 New Features
PPT
Introduction To Php For Wit2009
PDF
Php workshop L04 database
PPTX
Object-Oriented Programming with PHP (part 1)
PPTX
Introduction in php part 2
PDF
Php workshop L03 superglobals
PDF
Overview changes in PHP 5.4
PPT
Php mysql
PPTX
Arrays &amp; functions in php
PPT
Functions in php
PPT
PPT
PHP - Introduction to PHP Functions
Xslate sv perl-2013-7-11
4.2 PHP Function
Working with WP_Query in WordPress
DIG1108 Lesson 6
Developing applications for performance
PHP for hacks
Introduction To Lamp
Introduction in php
PHP 5.4 New Features
Introduction To Php For Wit2009
Php workshop L04 database
Object-Oriented Programming with PHP (part 1)
Introduction in php part 2
Php workshop L03 superglobals
Overview changes in PHP 5.4
Php mysql
Arrays &amp; functions in php
Functions in php
PHP - Introduction to PHP Functions
Ad

Similar to DIG1108C Lesson3 Fall 2014 (20)

PPT
Synapseindia reviews on array php
PPT
PPT
PPT
rtwerewr
PPT
MIND sweeping introduction to PHP
PPT
Php introduction with history of php
PPT
php fundamental
PPT
PPT
PHP - Introduction to PHP
PPTX
MongoDB's New Aggregation framework
PPT
Class 2 - Introduction to PHP
PDF
Php Introduction nikul
PPTX
Introduction To PHP000000000000000000000000000000.pptx
PDF
DIG1108C Lesson 6 - Fall 2014
PPT
Php classes in mumbai
PPTX
Lecture 9 - Intruduction to BOOTSTRAP.pptx
PPTX
Unit 4-6 sem 7 Web Technologies.pptx
PDF
Refactoring @ Mindvalley: Smells, Techniques and Patterns
PPTX
PHP from soup to nuts Course Deck
PDF
Yapc10 Cdt World Domination
Synapseindia reviews on array php
rtwerewr
MIND sweeping introduction to PHP
Php introduction with history of php
php fundamental
PHP - Introduction to PHP
MongoDB's New Aggregation framework
Class 2 - Introduction to PHP
Php Introduction nikul
Introduction To PHP000000000000000000000000000000.pptx
DIG1108C Lesson 6 - Fall 2014
Php classes in mumbai
Lecture 9 - Intruduction to BOOTSTRAP.pptx
Unit 4-6 sem 7 Web Technologies.pptx
Refactoring @ Mindvalley: Smells, Techniques and Patterns
PHP from soup to nuts Course Deck
Yapc10 Cdt World Domination
Ad

More from David Wolfpaw (17)

PDF
Running Your Service Business on WordPress
PPTX
Stop the Green Light Panic - Lisa Melegari
PDF
php[world] Hooks, Actions and Filters Oh My!
PDF
Hooks, Actions, and Filters Oh My!
PDF
DIG1108C Lesson 7 Fall 2014
PDF
WordPress as a Minimum Viable Product - WordCamp Tampa 2014
PDF
DIG1108C Lesson 5 Fall 2014
PDF
DIG1108C Lesson 4 Fall 2014
PDF
DIG1108C Lesson 2 Fall 2014
PDF
Dig1108C Lesson 1 Fall 2014
PPTX
Spring Cleaning on Your Site
PPTX
Becoming a Respected WordPress Developer
PPTX
Beginner Workshop WCMIA
PPTX
Basic word press development
PPTX
Geekaboo presentation 2013 - Brett Napoli
PPTX
Organization methods in word press
PPTX
WordPress tools and plugins
Running Your Service Business on WordPress
Stop the Green Light Panic - Lisa Melegari
php[world] Hooks, Actions and Filters Oh My!
Hooks, Actions, and Filters Oh My!
DIG1108C Lesson 7 Fall 2014
WordPress as a Minimum Viable Product - WordCamp Tampa 2014
DIG1108C Lesson 5 Fall 2014
DIG1108C Lesson 4 Fall 2014
DIG1108C Lesson 2 Fall 2014
Dig1108C Lesson 1 Fall 2014
Spring Cleaning on Your Site
Becoming a Respected WordPress Developer
Beginner Workshop WCMIA
Basic word press development
Geekaboo presentation 2013 - Brett Napoli
Organization methods in word press
WordPress tools and plugins

Recently uploaded (20)

PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
project resource management chapter-09.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Approach and Philosophy of On baking technology
PPTX
Tartificialntelligence_presentation.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Encapsulation theory and applications.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Chapter 5: Probability Theory and Statistics
Univ-Connecticut-ChatGPT-Presentaion.pdf
project resource management chapter-09.pdf
A comparative analysis of optical character recognition models for extracting...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Building Integrated photovoltaic BIPV_UPV.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Approach and Philosophy of On baking technology
Tartificialntelligence_presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Heart disease approach using modified random forest and particle swarm optimi...
Enhancing emotion recognition model for a student engagement use case through...
Unlocking AI with Model Context Protocol (MCP)
Assigned Numbers - 2025 - Bluetooth® Document
Encapsulation theory and applications.pdf
Web App vs Mobile App What Should You Build First.pdf
1 - Historical Antecedents, Social Consideration.pdf
Chapter 5: Probability Theory and Statistics

DIG1108C Lesson3 Fall 2014

  • 1. Intro To Server Side Programming Lesson Three
  • 2. Recap - What Have We Found? • Literals • boolean - True/False • integer • float - decimal numbers • string - text • array - ordered key/value pairs • object - literal within class • Null - no value
  • 3. Recap Continued • Operators • Arithmetic - $newvalue = $oldvalue + 1; • Assignment - $newervalue = 10; • Comparison - $newvalue != $oldvalue; • String Operators var_dump('foo' . 'bar'); $a = 'foo'; a .= 'bar'; var_dump($a);
  • 4. Order of Operations • PHP (and most languages) follows Operator Precedence rules • These allow for unambiguous statements • Parentheses can be used to override default Operator Precedence or to add visual clarity $taxable_income = $wages + $earnings - $deductions; $taxable_income = $wages + ( $earnings - $deductions );
  • 5. Programming Blocks • Blocks are sections of code grouped together • Blocks consist of declarations and statements • PHP organizes statements into blocks with { } • Conventions dictate indentation for readability {$foo=$bar+$bat;echo $foo;} { $foo = $bar + $bat; echo $foo; }
  • 6. Coding Conventions • A set of guidelines for a specific programming language of recommended styles, practices & methods for each aspect of a program • Covers things like file organization, indentation, comments, declarations, statements, white space, naming conventions, practices & principles • This improves the readability of code and makes software maintenance easier. • Conventions enforced by humans, not compilers
  • 7. Ease of Reading/Ease of Use • $UP=6;DN=19;$x=0; while(++$x<=24){echo "hour $x: "; if($x>+$UP&&$X<+$DN); echo "sun is up"; else echo "sun is down": echo "n"; } • define( 'SUNRISE', 6 ); define( 'SUNSET', 19 ); $hours = range( 1, 24); foreach ( $hours as $hour ) { // ternary operation $up_or_down = ( ( $hour >= SUNRISE and $hour <= SUNSET ) ? 'up' : 'down' ); echo "hour {$hour}: ", "sun is {$up_or_down}", "n"; }
  • 8. Assignment 3.1 Good Code, Bad Code
  • 9. Good Code, Bad Code • Log in to Github • Look through your forked projects for a block (~100) lines of code that are either very hard or very easy to read based on the coding style • Copy & paste into a file named assignment-3.1.md • Make a list with your partner of ways that the code style could be improved in each of your examples • Save files to share with the class. Push to Github? (https:// help.github.com/articles/create-a-repo)
  • 10. Git and Github - Here to Help • Git is your robot friend that remembers what you tell it to remember, and only that • This robot recognizes when things have changed • It knows how to remember, just not when • Git can tell you what changed and when, you use comments to tell it (and yourself) why • If you ask nicely (-h or --help) the robot will help • This robot is well organized and can track branches of changed code
  • 11. Basic git Commands • git branch - what branches are there & which am I on? • git status - what files have I changed or created? • git add (files) - consider this stuff for remembering • git commit (files) - I really want you to remember what I've considered via git add • git push [remote [branch] ] - tell the robot named "remote" (default is "origin") about my changes in "branch" (default is "master") • git fetch [remote] - ask the robot named "remote" for changes or branches that you don't know about yet • git merge [branch] - attempt to combine changes in "branch"