Programming Basics

  Home arrow Programming Basics arrow Page 2 - PHP Strings Primer
PROGRAMMING BASICS

PHP Strings Primer
By: Matt Wade
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    2003-07-11

    Table of Contents:
  • PHP Strings Primer
  • The Basics
  • Single Quotes
  • Double Quotes
  • Heredoc
  • Concatenation
  • Displaying Strings
  • echo
  • print
  • printf
  • Strings Formatting
  • Preparing user input for comparisons
  • Capitalization
  • Reversing strings
  • Padding strings
  • Multiple Lines
  • Data Preparation
  • Adding and Removing Slashes
  • Dealing with HTML Tags and Entities
  • Counting
  • Checking password strength
  • Generating Statistics
  • Substrings (and searching)
  • Extracting Substrings
  • Counting Paragraphs
  • Filtering Words
  • Working with email addresses
  • Manually Stripping Tags
  • Password Strength Revisited
  • Handling URLs and Base64-encoding
  • Parsing URLs
  • Encoding for URLs
  • Encoding for Email
  • Hashing
  • Verifying Integrity
  • User Authentication
  • Conclusion

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    PHP Strings Primer - The Basics


    (Page 2 of 37 )

    Before we jump into the variety of string functions offered in PHP it is important that we understand how strings are handled. We will need to examine the use of different quoting methods and the advantages and disadvantages of each. We will also cover the topic of concatenating strings together. The topics covered in this section are vital to the rest of this tutorial and, in turn, the rest of your programming career. The techniques discussed will be seen over and over again throughout the course of time and will be utilized in just about any PHP application you may develop. First, we will take a high level overview of each topic in this section.

  • Single quotes -The simplest method for quoting strings, this method is also the most efficient.
  • Double quotes -While not quite as efficient as single quotes, using double quotes allows for variable substitution and some simple formatting commands.
  • Heredoc -This not so common method can be used when you don't want to worry about escaping special characters. It also allows for variable substitution.
  • Concatenation -We will discuss combining strings and the most efficient methods for doing so.

    More Programming Basics Articles
    More By Matt Wade

    blog comments powered by Disqus
  • PROGRAMMING BASICS ARTICLES

    - Control Flow Constructs
    - More Time Manipulation with PHP
    - Validating and Manipulating Dates with PHP
    - Using the Date Constructor in PHP
    - Calendar Construction with PHP
    - PHP`s Calendar Package
    - Getting Modified Versions and Correct Dates ...
    - Combining Date Functions in PHP
    - Using PHP for Date and Time in Programming
    - More Exception Handling with PHP
    - Exception Handling in PHP
    - Error Logging and Handling Exceptions
    - Configuration Directives for Error and Excep...
    - Error and Exception Handling
    - Python Modules for Games


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap