Introduction to PHP (SDPHP)

  • 579 views
Uploaded on

A very good presentation that has been used by a couple presenters of the SDPHP group, including myself. Takes you from the very basics of PHP to more advanced ideas like OOP.

A very good presentation that has been used by a couple presenters of the SDPHP group, including myself. Takes you from the very basics of PHP to more advanced ideas like OOP.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
579
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
7
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. INTRODUCTION TO PHP SDPHPTwitter: @sdphp | www.sdphp.org (coming soon) MeetUp: www.meetup.com/SanDiegoPHP/
  • 2. Who we are:Presenters John Congdon - Senior Web Developer at Networx Online Twitter: @johncongdon Email: john@sdphp.org LinkedIn: http://www.linkedin.com/in/johncongdon Eric Van Johnson - Systems Architect at AMCO International Education Services, Inc. Twitter: @shocm Email: eric@sdphp.org LinkedIn: http://www.linkedin.com/in/vanjohnsonSan Diego PHP User Group San Diego PHP Meetups => http://www.meetup.com/SanDiegoPHP/ Facebook => https://www.facebook.com/groups/SanDiegoPUG/ IRC => freenode.net #sdphp Twitter => @sdphp
  • 3. A quick historyCreated in 1994 by Rasmus Lerdorf and was a set of simple Common GatewayInterface (CGI) binaries written in the C programming language that he used fortracking visits to his online resume, he named the suite of scripts "Personal HomePage Tools"In 1998 PHP 3.0 is announced and is a complete rewrite of the platform. By thistime Andi Gutmans and Zeev Suraski of Tel Aviv, Israel join Rasmus tocollaborate on the new implementation. This is also when PHP got its officialname PHP: Hypertext Preprocessor, which is a recursive acronym.
  • 4. A quick history (cont.)PHP 4 is released in 2000 sporting a new engine dubbed Zend Engine(comprised of the first names of Zeev and Andi). PHP 4.0 introduces a wide rangeof additional new features. In addition to the highly improved performance it alsoincluded key features such as support for many more web servers, HTTPsessions, output buffering, more secure ways of handling user input and severalnew language constructs.There are companies that still use PHP 4.x in their production environment. (Andwe like to make fun of them)PHP 5 released in 2004 powered by Zend Engine II with a new object mode.Current stable version of PHP is 5.4.8. Several new features come packed in thecurrent releases of PHP such as Namespace support, Native JSON support, andsecurity improvements.
  • 5. Who uses PHP? EVERYONE!Google / Yahoo / Facebook / Sony / Bank of America / NYSE / AT&T / Blah Blah Blah Blah
  • 6. OPEN & CLOSING TAGS
  • 7. VARIABLESA Variable, as the name suggests, can have itsvalue change during the execution of a script.
  • 8. CONSTANTSA constant, once defined, cannot be changedor unset. Traditionally constants are uppercase.
  • 9. INCLUDE FILE.. ONCE Useful for class and function loading
  • 10. INCLUDING MISSING SCRIPTS
  • 11. TYPES IN PHP ● Strings ● Integers ● Floats ● Arrays ● and many more...
  • 12. STRINGS Whats the difference?
  • 13. INTEGERS
  • 14. ARRAYS Arrays are zero-based. Arrays can be of mixed types
  • 15. ASSOCIATIVE ARRAYS Key => Value pairs of data
  • 16. FLOW CONTROL
  • 17. FOR LOOPS
  • 18. FOREACH LOOPS
  • 19. FOREACH LOOPS
  • 20. WHILE LOOPS
  • 21. DO WHILE
  • 22. SWITCH CASES
  • 23. CONTINUE AND BREAK ● for ● foreach ● while ● do ... while ● switch
  • 24. ALTERNATE SYNTAXES
  • 25. ALTERNATE SYNTAX: IF
  • 26. ALTERNATE SYNTAX: FOR
  • 27. ALTERNATE SYNTAX: FOREACHALTERNATE SYNTAX: WHILE
  • 28. FUNCTIONS
  • 29. CLASSES
  • 30. MAGIC: GET
  • 31. MAGIC: GET
  • 32. MAGIC: SET
  • 33. STATIC
  • 34. CLASS CONSTANTS
  • 35. CLASS VISIBILITY
  • 36. METHOD OVERLOADING
  • 37. DATABASE ACCESSWhy you should be using PDO (PHP Data Objects)● Cross Database Driver support● Prepared Statements● Proper bindings● and lots lots more
  • 38. MODELS, VIEWS, CONTROLLERS● Code Separation● Reusability● Ease Refactoring
  • 39. MODELS ● a model represents your data ● Logical container for ○ Database calls ○ API Access ● Models usually represent ○ Tables in a database ○ a file or collection of files on a hard drive ○ Documents stored in Mongo ○ Any other data containers you need to define
  • 40. VIEWS
  • 41. VIEW.. MODELS?
  • 42. CONTROLLERS
  • 43. Other Cool Things PHP Can Do ThatNot a Lot of People Know.● PHP CLI - PHP files dont have to be web pages. PHP is a very powerful language that can be used from the command line to perform a wide range of system task.● As of PHP 5.4.0, the CLI SAPI provides a built-in web server. $ cd ~/public_html $ php -S localhost:8000
  • 44. Other Cool Things (cont)● As of PHP 5.1.0, the CLI SAPI provides an interactive shell using the -a option.
  • 45. PHP Tools● Text Editor (Notepad / Notepad ++)● VimIDEs● Eclipse (Open Source) ○ PDT Plugin (Open Source) ○ Aptana PHP (Open Source) ■ Aptana Studio Pro (Commercial) ○ Zend Studio (Commercial)● NetBeans (Open Source)● PhpStorm (Commercial)● NuSphere PhpED (Commercial)
  • 46. What Do Employers Look For?● A college degree, so you are on the right track● Code examples. Will typically check for a Github account. Make sure you have some publicly contributed code. Open Source Projects are good place to do this.● Certifications ○ Zend PHP Certifications http://www.zend. com/services/certification/ ○ MySQL Developer http://education.oracle. com/pls/web_prod-plq-dad/db_pages.getpage? page_id=458&get_params=p_track_id:MDEV
  • 47. How Can You Improve Your Skills?● SD PHP User Group● Conferences ○ Code Works (Los Angeles Dec 12) ■ http://codeworks.phparch.com/los-angeles/ ○ PHP Tek (Chicago every year, usually May) ■ 2013 has not been announced yet ■ http://tek.phparch.com/ ○ ZendCon (October) ■ http://zendcon.com/● Contribute to Open Source● Practice, practice, practice● Learn to know what you dont know
  • 48. What Else Do Employers Look For? PASSIONDevelopment is a very personal thing.A developer needs to be creative,logical, focused, and enjoy what theyare doing. Get involved with the PHPcommunity. Forums, StackOverflow,Local User Groups like SDPHP ;-)
  • 49. ResourcesLocal San Diego PHP Meetups => http://www.meetup.com/SanDiegoPHP/ Facebook => https://www.facebook.com/groups/SanDiegoPUG/ IRC => freenode.net #sdphp Twitter => @sdphp / @shocm / @johncongdon / @williammanleyOthers Zend.com StackOverflow => http://stackoverflow.com/questions/tagged/php php|Arch => http://www.phparch.com/
  • 50. CreditsOriginal Presentation by William Cahill-Manley - Application Developer for Submodal Twitter: @williammanley Email: william@sdphp.orgTodays Presenters John Congdon - Senior Web Developer at Networx Online Twitter: @johncongdon Email: john@sdphp.org LinkedIn: http://www.linkedin.com/in/johncongdon Eric Van Johnson - Systems Architect at AMCO International Education Services, Inc. Twitter: @shocm Email: eric@sdphp.org LinkedIn: http://www.linkedin.com/in/vanjohnson