SlideShare une entreprise Scribd logo
1  sur  26
PHP 2 MDST 3559:  DataestheticsProf. Alvarado02/17/2011
Business VPN?
Review PHP Variables, Data Types, Functions See Chapters 2 through 5 of Programming PHP Text Earlier we saw the text handled as a tree (CSS, jQuery) Tuesday we treated the text as an array, a simple linear sequence,
Overview Today we will go back over the basics of PHP  To provide a slightly different angle on the subject To help clarify some concepts for those new to programming To help clarify the “PHP way” for those with experience Then we will cover two new topics Regular Expressions Creating your own functions
PHP as a language PHP is a programming langague (of course), but it has analogies to natural language as well There are parallels to the basic structures of human languages Which makes sense:  Programming languages are designed to mediate between human and machine language
What are some elements of natural language?
Some Elements of Natural Language Words Meanings Sentences Something is said of something else Parts of speech: nouns, verbs, prepositions Heart of language as language, beyond mere signs Paragraphs
PHP has all of these things
Values are Meanings Values are pieces of data Languages are all about doing things with data Data comes in types Types include strings and numbers Also Boolean values (true/false) Values are expressed literally and signified like so: “Hello, World!” 5 true These are the meanings of the language
Variables are Nouns Variables are words that can have meaning $POTUS = “Obama”; The President of the U.S. is Obama. Like the difference between person and office  They are like nouns that refer to things  Things being values ... They are always prefixed by $ and are case sensitive
(Arrays) Arrays are admittedly weird But they can be thought of as words that stand for collections, e.g. The Pittsburgh Steelers The UVA student body These phrases imply a structure Albeit much more complicated than arrays But not much: consider rosters ...
Functions are Verbs Functions are like verbs $food = food_shop($me,$money,$humger_level) Like verbs, they may require arguments and imply a result Verbs are action words Consider transitive versus intransitive They are not prefixed by $ They are not case sensitive They are followed by parentheses
Functions Verbs have implicit arguments and effects Subjects, objects, indirect objects, are like arguments Intransitive verbs are like functions that don’t take an argument Or, it is implicit (the subject) Functions like verbs imply actions that produce effects Person A: He ran for office. Person B: And ... ?
Expressions Expressions are like phrases that combine nouns and verbs 5 (5 + 10) / 36 “Tina” . “ is my cat”; file($url) $foo All expressions result in a value 5 0.4166666 ... Tina is my cat [the array of the file] [whatever $foo was last set to]
Statements Statements are like sentences.   They combine one or more expressions. $my_cat = “Tina”; $x = 2+2; They say something about something My Cat is Tina. $foois 2+2 (is 5) The verb “to be” is an assignment operator ... They are always punctuated by a semi-colon
Operators Expressions and statements are built out of words by combining them with grammatical words, such as prepositions and conjunctions Iam in the house. I own a catanda dog. Operators are like the grammatical words They don’t have meanings, they have functions They don’t reference values (i.e. data), they do things with values
Operators Arithmetic Addition, subtraction, division, multiplication, etc. String Concatenation Assignment X is Y Logical Is X Y? Is X related to Y in some  specified way?
Structures Structures, or control structures, are like stories or narrative patterns Built-in functions control conditions and iteration Repetition and branching
Conditions if / elseif/ else if ($x == ‘foo’) { 	// do something } elseif ($x == ‘bar’) { 	// do something else  } else {   	// do something else }
Iteration foreach() while()
Summary Values are like meanings Variables are like nouns Functions are like verbs Operators are like grammatical words These are combined to form expressions and statements Statements are structured in stories, or algorithms with control structures
Exercise Create directory for today Copy rex.php into it Let’s revisit the program and use control structures to format the text Use foreach() to loop through the file Use IF statements to grab what we want Format the text with tags
Two new functions preg_match($pattern, $string)  Two arguments A regular expression pattern (between slashes “/.../”) A string to apply the expression to preg_replace($pattern,$replacement,$string) Three arguments A regular expression A something to replace the matched string with A string to apply the expression to
Regular Expressions . = any character + = one or more * = 0 or more ^ = beginning of the string $ = end of the string [A-Za-z] = character set of all letters () = something to be replaced
Assignment Grab the Oedipux text  Trim the leading and trailing HTML tags Reformat each line using either DIV or P elements Create an appropriate CSS stylesheet for the text

Contenu connexe

Tendances

Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming LanguageReham AlBlehid
 
Introduction to prolog
Introduction to prologIntroduction to prolog
Introduction to prologHarry Potter
 
10 logic+programming+with+prolog
10 logic+programming+with+prolog10 logic+programming+with+prolog
10 logic+programming+with+prologbaran19901990
 
Enhanced E-R diagram
Enhanced E-R diagramEnhanced E-R diagram
Enhanced E-R diagramMayank Jain
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraintsNikhil Deswal
 
Artificial intelligence Prolog Language
Artificial intelligence Prolog LanguageArtificial intelligence Prolog Language
Artificial intelligence Prolog LanguageREHMAT ULLAH
 
24042020_normalization 1.pdf
24042020_normalization 1.pdf24042020_normalization 1.pdf
24042020_normalization 1.pdfShivani139202
 
Lesson 1 function as model
Lesson 1 function as modelLesson 1 function as model
Lesson 1 function as modelrey castro
 
Prolog 01
Prolog 01Prolog 01
Prolog 01saru40
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLEVraj Patel
 

Tendances (18)

Prolog Programming Language
Prolog Programming  LanguageProlog Programming  Language
Prolog Programming Language
 
Introduction to prolog
Introduction to prologIntroduction to prolog
Introduction to prolog
 
10 logic+programming+with+prolog
10 logic+programming+with+prolog10 logic+programming+with+prolog
10 logic+programming+with+prolog
 
Enhanced E-R diagram
Enhanced E-R diagramEnhanced E-R diagram
Enhanced E-R diagram
 
Cardinality and participation constraints
Cardinality and participation constraintsCardinality and participation constraints
Cardinality and participation constraints
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Artificial intelligence Prolog Language
Artificial intelligence Prolog LanguageArtificial intelligence Prolog Language
Artificial intelligence Prolog Language
 
Chaps 1-3-ai-prolog
Chaps 1-3-ai-prologChaps 1-3-ai-prolog
Chaps 1-3-ai-prolog
 
Normalization
NormalizationNormalization
Normalization
 
Prolog basics
Prolog basicsProlog basics
Prolog basics
 
24042020_normalization 1.pdf
24042020_normalization 1.pdf24042020_normalization 1.pdf
24042020_normalization 1.pdf
 
Lesson 1 function as model
Lesson 1 function as modelLesson 1 function as model
Lesson 1 function as model
 
Prolog 01
Prolog 01Prolog 01
Prolog 01
 
Ics1019 ics5003
Ics1019 ics5003Ics1019 ics5003
Ics1019 ics5003
 
Introduction to Prolog
Introduction to PrologIntroduction to Prolog
Introduction to Prolog
 
Prolog
PrologProlog
Prolog
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
prolog ppt
prolog pptprolog ppt
prolog ppt
 

En vedette

Mdst 3559-01-27-data-journalism-studio
Mdst 3559-01-27-data-journalism-studioMdst 3559-01-27-data-journalism-studio
Mdst 3559-01-27-data-journalism-studioRafael Alvarado
 
Mdst 3559-03-03-sql-php-2
Mdst 3559-03-03-sql-php-2Mdst 3559-03-03-sql-php-2
Mdst 3559-03-03-sql-php-2Rafael Alvarado
 
Mdst3559 2011-05-03-final-day
Mdst3559 2011-05-03-final-dayMdst3559 2011-05-03-final-day
Mdst3559 2011-05-03-final-dayRafael Alvarado
 
UVA MDST 3073 Texts and Models-2012-09-11
UVA MDST 3073 Texts and Models-2012-09-11UVA MDST 3073 Texts and Models-2012-09-11
UVA MDST 3073 Texts and Models-2012-09-11Rafael Alvarado
 
Mdst 3559-04-05-networks-and-graphs
Mdst 3559-04-05-networks-and-graphsMdst 3559-04-05-networks-and-graphs
Mdst 3559-04-05-networks-and-graphsRafael Alvarado
 

En vedette (8)

Mdst 3559-02-01-html
Mdst 3559-02-01-htmlMdst 3559-02-01-html
Mdst 3559-02-01-html
 
MDST 3703 F10 Studio 11
MDST 3703 F10 Studio 11MDST 3703 F10 Studio 11
MDST 3703 F10 Studio 11
 
Mdst 3559-01-27-data-journalism-studio
Mdst 3559-01-27-data-journalism-studioMdst 3559-01-27-data-journalism-studio
Mdst 3559-01-27-data-journalism-studio
 
Mdst 3559-03-03-sql-php-2
Mdst 3559-03-03-sql-php-2Mdst 3559-03-03-sql-php-2
Mdst 3559-03-03-sql-php-2
 
Mdst3559 2011-05-03-final-day
Mdst3559 2011-05-03-final-dayMdst3559 2011-05-03-final-day
Mdst3559 2011-05-03-final-day
 
UVA MDST 3073 Texts and Models-2012-09-11
UVA MDST 3073 Texts and Models-2012-09-11UVA MDST 3073 Texts and Models-2012-09-11
UVA MDST 3073 Texts and Models-2012-09-11
 
Mdst 3559-04-05-networks-and-graphs
Mdst 3559-04-05-networks-and-graphsMdst 3559-04-05-networks-and-graphs
Mdst 3559-04-05-networks-and-graphs
 
MDST 3703 F10 Seminar 1
MDST 3703 F10 Seminar 1MDST 3703 F10 Seminar 1
MDST 3703 F10 Seminar 1
 

Similaire à Mdst 3559-02-17-php2

Systemic Functional Grammar
Systemic Functional Grammar Systemic Functional Grammar
Systemic Functional Grammar Sugeng Hariyanto
 
Mdst3705 2013-02-05-databases
Mdst3705 2013-02-05-databasesMdst3705 2013-02-05-databases
Mdst3705 2013-02-05-databasesRafael Alvarado
 
Syntax 334 lecture 3
Syntax 334 lecture 3Syntax 334 lecture 3
Syntax 334 lecture 3Akashgary
 
Mind map esl 502
Mind map esl 502Mind map esl 502
Mind map esl 502k1hinze
 
Possible Word Representation
Possible Word RepresentationPossible Word Representation
Possible Word Representationchauhankapil
 
Introduction to Distributional Semantics
Introduction to Distributional SemanticsIntroduction to Distributional Semantics
Introduction to Distributional SemanticsAndre Freitas
 
Chart during reading strategies
Chart during reading strategiesChart during reading strategies
Chart during reading strategiesSECCIONDEINGLES
 
Beginners Guide on PHP Programming
Beginners Guide on PHP ProgrammingBeginners Guide on PHP Programming
Beginners Guide on PHP ProgrammingKindle Books
 
Representation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logicsRepresentation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logicschauhankapil
 
An Intuitive Natural Language Understanding System
An Intuitive Natural Language Understanding SystemAn Intuitive Natural Language Understanding System
An Intuitive Natural Language Understanding Systeminscit2006
 
Lexical functional grammar (lfg).pptx
Lexical functional grammar (lfg).pptxLexical functional grammar (lfg).pptx
Lexical functional grammar (lfg).pptxjhonalyntizon
 
Nouns (sustantivos)
Nouns (sustantivos)Nouns (sustantivos)
Nouns (sustantivos)Juan Otero
 
Unit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfUnit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfHrideshSapkota2
 

Similaire à Mdst 3559-02-17-php2 (20)

Systemic Functional Grammar
Systemic Functional Grammar Systemic Functional Grammar
Systemic Functional Grammar
 
Textmining
TextminingTextmining
Textmining
 
Mdst3705 2013-02-05-databases
Mdst3705 2013-02-05-databasesMdst3705 2013-02-05-databases
Mdst3705 2013-02-05-databases
 
Syntax 334 lecture 3
Syntax 334 lecture 3Syntax 334 lecture 3
Syntax 334 lecture 3
 
Mind map esl 502
Mind map esl 502Mind map esl 502
Mind map esl 502
 
Possible Word Representation
Possible Word RepresentationPossible Word Representation
Possible Word Representation
 
Syntax
SyntaxSyntax
Syntax
 
unit -3 part 1.ppt
unit -3 part 1.pptunit -3 part 1.ppt
unit -3 part 1.ppt
 
NLP
NLPNLP
NLP
 
Introduction to Distributional Semantics
Introduction to Distributional SemanticsIntroduction to Distributional Semantics
Introduction to Distributional Semantics
 
Php
PhpPhp
Php
 
Chart during reading strategies
Chart during reading strategiesChart during reading strategies
Chart during reading strategies
 
Beginners Guide on PHP Programming
Beginners Guide on PHP ProgrammingBeginners Guide on PHP Programming
Beginners Guide on PHP Programming
 
Representation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logicsRepresentation of syntax, semantics and Predicate logics
Representation of syntax, semantics and Predicate logics
 
An Intuitive Natural Language Understanding System
An Intuitive Natural Language Understanding SystemAn Intuitive Natural Language Understanding System
An Intuitive Natural Language Understanding System
 
Lexical functional grammar (lfg).pptx
Lexical functional grammar (lfg).pptxLexical functional grammar (lfg).pptx
Lexical functional grammar (lfg).pptx
 
Syntax
SyntaxSyntax
Syntax
 
Nouns (sustantivos)
Nouns (sustantivos)Nouns (sustantivos)
Nouns (sustantivos)
 
Knowledge Extraction
Knowledge ExtractionKnowledge Extraction
Knowledge Extraction
 
Unit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdfUnit-4-Knowledge-representation.pdf
Unit-4-Knowledge-representation.pdf
 

Plus de Rafael Alvarado

Mdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsMdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsRafael Alvarado
 
Mdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyMdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyRafael Alvarado
 
Mdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextMdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextRafael Alvarado
 
Mdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlMdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlRafael Alvarado
 
Mdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsMdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsRafael Alvarado
 
Mdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsMdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsRafael Alvarado
 
Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Rafael Alvarado
 
Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Rafael Alvarado
 
Mdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldMdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldRafael Alvarado
 
UVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionUVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionRafael Alvarado
 
MDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationMDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationRafael Alvarado
 
Mdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreMdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreRafael Alvarado
 
Mdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataMdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataRafael Alvarado
 
Mdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataMdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataRafael Alvarado
 
Mdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisMdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisRafael Alvarado
 
Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Rafael Alvarado
 
Mdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageMdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageRafael Alvarado
 
Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Rafael Alvarado
 
Mdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionMdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionRafael Alvarado
 

Plus de Rafael Alvarado (20)

Mdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collectionsMdst3703 2013-10-08-thematic-research-collections
Mdst3703 2013-10-08-thematic-research-collections
 
Mdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-historyMdst3703 2013-10-01-hypertext-and-history
Mdst3703 2013-10-01-hypertext-and-history
 
Mdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertextMdst3703 2013-09-24-hypertext
Mdst3703 2013-09-24-hypertext
 
Presentation1
Presentation1Presentation1
Presentation1
 
Mdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-htmlMdst3703 2013-09-12-semantic-html
Mdst3703 2013-09-12-semantic-html
 
Mdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-modelsMdst3703 2013-09-17-text-models
Mdst3703 2013-09-17-text-models
 
Mdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signalsMdst3703 2013-09-10-textual-signals
Mdst3703 2013-09-10-textual-signals
 
Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2Mdst3703 2013-09-05-studio2
Mdst3703 2013-09-05-studio2
 
Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2Mdst3703 2013-09-03-plato2
Mdst3703 2013-09-03-plato2
 
Mdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-worldMdst3703 2013-08-29-hello-world
Mdst3703 2013-08-29-hello-world
 
UVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 IntroductionUVA MDST 3703 2013 08-27 Introduction
UVA MDST 3703 2013 08-27 Introduction
 
MDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to VisualizationMDST 3705 2012-03-05 Databases to Visualization
MDST 3705 2012-03-05 Databases to Visualization
 
Mdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genreMdst3705 2013-02-26-db-as-genre
Mdst3705 2013-02-26-db-as-genre
 
Mdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-dataMdst3705 2013-02-19-text-into-data
Mdst3705 2013-02-19-text-into-data
 
Mdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-dataMdst3705 2013-02-12-finding-data
Mdst3705 2013-02-12-finding-data
 
Mdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxisMdst3705 2013-01-29-praxis
Mdst3705 2013-01-29-praxis
 
Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3Mdst3705 2013-01-31-php3
Mdst3705 2013-01-31-php3
 
Mdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-languageMdst3705 2012-01-22-code-as-language
Mdst3705 2012-01-22-code-as-language
 
Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2Mdst3705 2013-01-24-php2
Mdst3705 2013-01-24-php2
 
Mdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introductionMdst3705 2012-01-15-introduction
Mdst3705 2012-01-15-introduction
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Dernier (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Mdst 3559-02-17-php2

  • 1. PHP 2 MDST 3559: DataestheticsProf. Alvarado02/17/2011
  • 3. Review PHP Variables, Data Types, Functions See Chapters 2 through 5 of Programming PHP Text Earlier we saw the text handled as a tree (CSS, jQuery) Tuesday we treated the text as an array, a simple linear sequence,
  • 4. Overview Today we will go back over the basics of PHP To provide a slightly different angle on the subject To help clarify some concepts for those new to programming To help clarify the “PHP way” for those with experience Then we will cover two new topics Regular Expressions Creating your own functions
  • 5. PHP as a language PHP is a programming langague (of course), but it has analogies to natural language as well There are parallels to the basic structures of human languages Which makes sense: Programming languages are designed to mediate between human and machine language
  • 6. What are some elements of natural language?
  • 7.
  • 8. Some Elements of Natural Language Words Meanings Sentences Something is said of something else Parts of speech: nouns, verbs, prepositions Heart of language as language, beyond mere signs Paragraphs
  • 9. PHP has all of these things
  • 10. Values are Meanings Values are pieces of data Languages are all about doing things with data Data comes in types Types include strings and numbers Also Boolean values (true/false) Values are expressed literally and signified like so: “Hello, World!” 5 true These are the meanings of the language
  • 11. Variables are Nouns Variables are words that can have meaning $POTUS = “Obama”; The President of the U.S. is Obama. Like the difference between person and office They are like nouns that refer to things Things being values ... They are always prefixed by $ and are case sensitive
  • 12. (Arrays) Arrays are admittedly weird But they can be thought of as words that stand for collections, e.g. The Pittsburgh Steelers The UVA student body These phrases imply a structure Albeit much more complicated than arrays But not much: consider rosters ...
  • 13. Functions are Verbs Functions are like verbs $food = food_shop($me,$money,$humger_level) Like verbs, they may require arguments and imply a result Verbs are action words Consider transitive versus intransitive They are not prefixed by $ They are not case sensitive They are followed by parentheses
  • 14. Functions Verbs have implicit arguments and effects Subjects, objects, indirect objects, are like arguments Intransitive verbs are like functions that don’t take an argument Or, it is implicit (the subject) Functions like verbs imply actions that produce effects Person A: He ran for office. Person B: And ... ?
  • 15. Expressions Expressions are like phrases that combine nouns and verbs 5 (5 + 10) / 36 “Tina” . “ is my cat”; file($url) $foo All expressions result in a value 5 0.4166666 ... Tina is my cat [the array of the file] [whatever $foo was last set to]
  • 16. Statements Statements are like sentences. They combine one or more expressions. $my_cat = “Tina”; $x = 2+2; They say something about something My Cat is Tina. $foois 2+2 (is 5) The verb “to be” is an assignment operator ... They are always punctuated by a semi-colon
  • 17. Operators Expressions and statements are built out of words by combining them with grammatical words, such as prepositions and conjunctions Iam in the house. I own a catanda dog. Operators are like the grammatical words They don’t have meanings, they have functions They don’t reference values (i.e. data), they do things with values
  • 18. Operators Arithmetic Addition, subtraction, division, multiplication, etc. String Concatenation Assignment X is Y Logical Is X Y? Is X related to Y in some specified way?
  • 19. Structures Structures, or control structures, are like stories or narrative patterns Built-in functions control conditions and iteration Repetition and branching
  • 20. Conditions if / elseif/ else if ($x == ‘foo’) { // do something } elseif ($x == ‘bar’) { // do something else } else { // do something else }
  • 22. Summary Values are like meanings Variables are like nouns Functions are like verbs Operators are like grammatical words These are combined to form expressions and statements Statements are structured in stories, or algorithms with control structures
  • 23. Exercise Create directory for today Copy rex.php into it Let’s revisit the program and use control structures to format the text Use foreach() to loop through the file Use IF statements to grab what we want Format the text with tags
  • 24. Two new functions preg_match($pattern, $string) Two arguments A regular expression pattern (between slashes “/.../”) A string to apply the expression to preg_replace($pattern,$replacement,$string) Three arguments A regular expression A something to replace the matched string with A string to apply the expression to
  • 25. Regular Expressions . = any character + = one or more * = 0 or more ^ = beginning of the string $ = end of the string [A-Za-z] = character set of all letters () = something to be replaced
  • 26. Assignment Grab the Oedipux text Trim the leading and trailing HTML tags Reformat each line using either DIV or P elements Create an appropriate CSS stylesheet for the text