Built-in Functions.

Slides:



Advertisements
Similar presentations
Objectives After completing this lesson, you should be able to do the following: Describe various types of conversion functions that are available in.
Advertisements

Copyright © 2007, Oracle. All rights reserved Using Single-Row Functions to Customize Output Modified: October 21, 2014.
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2010 All Rights Reserved. 1.
Entering Data in Excel. Entering numbers, text, a date, or a time n 1Click the cell where you want to enter data. n 2Type the data and press ENTER or.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Includes and Dates.
TELLING TIME LINKS Identifies days, weeks, and months on a calendar.
SESSIONS 27/2/12 Lecture 8. ? Operator Similar to the if statement but returns a value derived from one of two expressions by a colon. Syntax: (expression)
Slide 1 PHP Predefined Functions ITWA113. Murach’s ASP.NET 3.5/C#, C1© 2008, Mike Murach & Associates, Inc. Slide 2 PHP Predefined Functions Objectives.
Working with Date and Time ISYS 475. How PHP processes date and time? Traditional way: – Timestamp Newer and object oriented way: – DateTime class.
PRÁCE S ČASEM V PHP. DATE  string date ( string $format [, int $timest amp = time() ] )  echo date('l jS \of F Y h:i:s A');  Monday 8th of August 2005.
CALENDAR YEAR PLAN JANUARY FEBRUARY MARCH APRIL MAY JUNE.
Moon Journal 2/22/ /14/2016. Date 2/22/2016 Phase Full Sunrise 7:06am Sunset 6:21pm Do not color in the moon at all. Leave white (lit)
Leap Year Math Quiz!. List the next five leap years after 2012.
CHRISTMAS EVE SERVICE: CHRISTMAS DAY: Spanish ONLY
School Year Calendar You can print this template to use it as a wall calendar, or you can copy the page for any month to add it to your own.
LITTLE BUSHEY SURGERY CHRISTMAS 2016 AND NEW YEAR 2017 SURGERY OPENING HOURS Friday 23rd December am-12.30pm 1.15pm – 6.30pm Saturday.
SJN Faith Formation 2016/2017 Sunday gr 1-6 Sunday HS-A 4:30-6:00pm
Math Practice platform
Open Source Server Side Scripting Permissions & Users
Ethan & Fletcher’s Day Day of the week Time Date Day / Month / Year 12
CS31 Discussion 1E Jie(Jay) Wang Week5 Oct.27.
Do you know all these facts?
JavaScript Arrays Date
SQL DATE/TIME FUNCTIONS
Christmas & New Year Opening Times
Payroll Calendar Fiscal Year
How to… Use Crontab for SFX
Days of the Week Les docs d’Estelle –
Time Revision.
Second Grade Saxon Math Lesson 30A
Formatting Output.
Fun with dates and calendars
School Year Calendar You can print this template to use it as a wall calendar, or you can copy the page for any month to add it to your own presentation.
13-block rotation schedule
A note from the 1st grade teachers:
Fun with dates and calendars
Logo Calendar – January 2012 TO DO LIST 01/04/2012 Example TO DO LIST
Christmas Events at St Peter’s.
Unit 1 School Life. Unit 1 School Life Reporting school activities Task Reporting school activities.
Christmas Opening Hours
MY FUNDAY.
TERM JUNIOR PROGRAM MONDAY 29th JANUARY – SUNDAY 15th APRIL
NEW ARRIVALS NEW ARRIVALS OUT WITH THE OLD OUT WITH THE OLD
Web Programming Language
School Year Calendar You can print this template to use it as a wall calendar, or you can copy the page for any month to add it to your own presentation.
Moon Journal 2/22/ /14/2016.
ISPM Practical.
Created by: Ramona Lewis-Dailey
Henry Lomb Parent Calendar
Extended Christmas Hours Thursday December 8th 9am -6:30pm Friday December 9th 9am -6:30pm Saturday December 10th 9am-6pm Thursday December.
php.ini (in C:\xampp\php\) date.timezone = Asia/Taipei
January 2015 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
School 20 Parent Calendar
ISPM Practical.
Primary Longman Elect 4A Chapter 5 Text Type Posters.
Advanced Concepts and AJAX
JUNE 2010 CALENDAR PROJECT PLANNING 1 Month MONDAY TUESDAY WEDNESDAY
Created by: Ramona Lewis-Dailey
NOVEMBER READING LOG Student: When you have read, record your minutes and have your parent initial the proper box (each day). At the end of the month,
SECONDARY 1(2018) REGISTRATION
Classes resume Sunday 6th Dec
HTML Forms What are clients? What are servers?
DECEMBER READING LOG Student: When you have read, record your minutes and have your parent initial the proper box (each day). At the end of the month,
Who Wants to be a Millionaire?
Do you know all these facts?
Reviewing Abbreviations

UNITS OF TIME QUESTIONS.
Temporal Data Part V.
September 2018 Fours Class August 27 August 28 August 29 August 30
Presentation transcript:

Built-in Functions

echo strrev("Hello world."); Prints: .dlrow 0lleH

echo str_repeat("Hip ", 2); Prints: Hip Hip

echo strtoupper("lowercase"); Prints: LOWERCASE

str_replace("text_to_find", "text_to_replace_it_with", name_of_string_to_work_on); $strWord="abcdefg"; $strWord=str_replace("a","aa",$strWord); $strWord=str_replace("b","bb",$strWord); $strWord=str_replace("c","cc",$strWord); $strWord=str_replace("d","dd",$strWord); $strWord=str_replace("e","ee",$strWord); $strWord=str_replace("f","ff",$strWord); $strWord=str_replace("g","gg",$strWord); echo $strWord; Prints: aabbccddeeffgg

Good example: Formatting Output as Currency (Money) Formatting Functions output text with formatting applied to it using special formatting characters Good example: Formatting Output as Currency (Money)

Time & Date Functions

checkdate(m, d, y) determines if the date specified by a month, day, and year really exists on the calendar. $valid=checkdate(13,1,1978); if($valid) echo "Real date"; else echo "Not real date";

mktime creates a timestamp for a given date and time. It takes as parameters the hour, minutes, seconds, month, day, and year. echo mktime(0,0,0,1,1,2000); //create timestamp for given date //number of hour 0-23 //number of minutes 0-59 //number of seconds 0-59 //number of month 1-12 //number of day 1-31 //year 1901-2038 The timestamp, used alone, is, as you can see, not all that useful. You can, however use it along with another function called date.

Leave this off to use current date/time Format: date($format, $timestamp); Example: $timestamp= mktime(0,0,0,1,1,2000); //create timestamp for given date echo date(SOME_FORMAT_YOU_SPECIFIED,$timestamp)."<br />"; Leave this off to use current date/time

Format Description Returned Value DAY SPECIFIERS d Day of month 2 digit, leading zeroes 01 to 31 D Day of week, three letters Mon to Sun j Day of month, no lead zeroes 1 to 31 l Day of week, full names Sunday to Saturday N Day of week, numeric, Monday to Sunday 1 to 7 S Suffix for day o fmonth st,nd, rd, or th w Day of week, numeric, Sunday to Sat 0 to 6 z Day of year 0 to 365 WEEK SPECIFIER W Week number of year 1 to 52 MONTH SPECIFIERS F Month name January to December m Month number with lead zeroes 01 to 12 M Month name, three letters Jan to Dec n Month number, no lead zeroes 1 to 12 t Number of days in given month 28, 29, 30, or 31 YEAR SPECIFIERS L Leap year 1=yes, 0=no Y Year, 4 digits 0000 to 9999 y Year, 2 digits 00 to 99 TIME SPECIFIERS a Before/after midday, lowercase am, pm A Before, after midday, uppercase AM, PM g Hour of day, 12-hr, no lead zeroes G Hour of day, 24-hr, no lead zeroes 1 to 24 h Hour of day, 12, lead zeroes H Hour of day, 24, lead zeroes 01 to 24 i Minutes with lead zeroes 00 to 59 s Seconds, with lead zeroes

$timestamp= mktime(6,0,0,7,14,1978); $format="D, F j, Y"; Example $timestamp= mktime(6,0,0,7,14,1978); $format="D, F j, Y"; echo "I was born " . date($format,$timestamp);

$right_now=date("L"); if($right_now==1) echo "This is a leap year"; else echo "This is not a leap year.";

More Info http://php.net/manual/en/langref.php http://php.net/manual/en/ref.strings.php http://php.net/manual/en/ref.datetime.php