Embedded PHP in HTML 5 & Strings in PHP

Slides:



Advertisements
Similar presentations
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 9 Strings.
Advertisements

NUMERIC ARRAYS DEBBI HAMNER CIT 336 TEACHING PRESENTATION.
ITC 240: Web Application Programming SUBHASH PRAJAPATI 04/14/15.
Regular expressions (contd.) -- remembering subpattern matches When a is being matched with a target string, substrings that match sub-patterns can be.
Operations & Strings CSCI 116 Web Programming I. 2 Arithmetic Operators Arithmetic operators are used to perform mathematical calculations.
Manipulating Strings. Name of Book2 Objectives Manipulate strings Parse strings Compare strings Handle form submissions.
PHP Stringjet / Strukturat mbi Stringjet / Operatoret / Kushtet / Loops.
. If the PHP server is an server or is aware of which server is the server, then one can write code that s information. –For example,
PHP Overview CS PHP PHP = PHP: Hypertext Preprocessor Server-side scripting language that may be embedded into HTML One goal is to get PHP files.
PHP : Hypertext Preprocessor
Strings and Arrays. String Is a sequence of characters. Example: “hello”, “how are you?”, “123”,and are all valid string values.
INTERNET APPLICATION DEVELOPMENT For More visit:
Chapter 3 Manipulating Strings PHP Programming with MySQL 2nd Edition
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Nael Alian Introduction to PHP
PHP Using Strings 1. Replacing substrings (replace certain parts of a document template; ex with client’s name etc) mixed str_replace (mixed $needle,
PHP Controlling Program Flow Mohammed M. Hassoun 2012.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
CPT: Strings/ Computer Programming Techniques Semester 1, 1998 Objectives of these slides: –to discuss strings and their relationship.
Strings in PHP Working with Text in PHP Strings and String Functions Mario Peshev Technical Trainer Software University
PHP Conditional Statements Conditional statements in PHP are used to perform different actions based on different conditions. Conditional Statements Very.
Web Database Programming Week 3 PHP (2). Functions Group related statements together to serve “a” specific purpose –Avoid duplicated code –Easy maintenance.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Introduction to PHP Advanced Database System Lab no.1.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Comments in PHP In PHP, we use // to make a singleline comment or /* and */ to make a large comment block. Comment is a part of your PHP code that will.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
Regular Expressions for PHP Adding magic to your programming. Geoffrey Dunn
1 PHP Intro PHP Strings After this lecture, you should be able to: Manipulate and Output PHP Strings: Manipulate and Output PHP Strings: Single- or Double-quoted.
PHP’s Regular Expression Functions (Perl Compatible) Examples taken from: Beginning PHP 5 and MySQL 5 From Novice to Professional.
PHP 4 Files, Functions. Opening a File The fopen() function is used to open files in PHP. The first parameter of this function contains the name of the.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
PHP Variables.  Variables are "containers" for storing information. How to Declare PHP Variables  In PHP, a variable starts with the $ sign, followed.
 A PHP script can be placed anywhere in the document.  A PHP script starts with  The default file extension for PHP files is ".php".  A PHP file normally.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
What is Binary Code? Computers use a special code of their own to express the digital information they process. It's called the binary code because it.
Regular Expressions. What is it 4? Text searching & replacing Sequence searching (input, DNA) Sequence Tracking Machine Operation logic machines that.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
Regular Expressions In Javascript cosc What Do They Do? Does pattern matching on text We use the term “string” to indicate the text that the regular.
GCSE COMPUTER SCIENCE Practical Programming using Python
Web Systems & Technologies
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
เอกสารประกอบการบรรยายรายวิชา Web Technology
PHP 5 Syntax.
PHP Hypertext Preprocessor
Introduction to Web programming
PHP (PHP: Hypertext Preprocessor)
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
PHP Rasmus Lerdorf.
PHP Variables A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume) Rules for PHP variables: A variable.
Ch. 3. PHP (이 강의 내용의 대부분 예들은 w3schools. com/php/default
PHP Function.
Strings.
PHP.
Functions, Regular expressions and Events
Introduction to PHP and MySQL (Creating Database-Driven Websites)
Text Analyzer BIS1523 – Lecture 14.
String functions
Basics.
Lesson 3: Find and Replace Tools
Web Programming Language
Introduction to Computer Science
String functions
PHP –Regular Expressions
Presentation transcript:

Embedded PHP in HTML 5 & Strings in PHP

Embedded PHP in HTML 5 <html> <body> <h1>My first PHP page</h1> <?php echo "Hello World!"; ?> </body> </html>

Strings and Regular Expression in PHP A string is a sequence of characters, like "Hello world!". PHP String Functions: Get The Length of a String The PHP strlen() function returns the length of a string.

Continued.. The example below returns the length of the string "Hello world!": <?php echo strlen("Hello world!"); // outputs 12 ?> Output: 12

Continued.. Count The Number of Words in a String The PHP str_word_count() function counts the number of words in a string: <?php echo str_word_count("Hello world!"); // outputs 2 ?> The output of the code above will be: 2.

Continued.. Reverse a String The PHP strrev() function reverses a string: <?php echo strrev("Hello world!"); // outputs !dlrow olleH ?>

Continued.. Search For a Specific Text Within a String The PHP strpos() function searches for a specific text within a string. If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE.

Continued.. The example below searches for the text "world" in the string "Hello world!": <?php echo strpos("Hello world!", "world"); // outputs 6 ?> The output of the code above will be: 6. Note: The first character position in a string is 0 (not 1).

Continued.. Replace Text Within a String The PHP str_replace() function replaces some characters with some other characters in a string. The example below replaces the text "world" with "Dolly": <?php echo str_replace("world", "Dolly", "Hello world!"); // outputs Hello Dolly! ?>