|
|
||||||||
| Home Page |
||||||||
Self-taught Php: String Functions Quick StartSelf-Taught PHP - String Functions Quick Start by Bill Hamilton An on-the-fly kind of programmer looking at an unfamiliar lanquage needs first of all a reference of the set of necessary and commonly used functions. This tutorial provides a quick reference of the essential string functions followed by some condensed notes and then a very brief list of PHP operators and process control. Functions Here are some translation examples for Visual Basic programmers: These are the basic string functions you expect of a scripting lanquage - finding a substring, replacing portions of a string, and breaking a string up. All of the indexes into the string are zero-based (the first character is at position 0). A handy feature to keep in mind is that the starting positions can be negative, which means you count from the end of the string rather than the beginning. The final necessary function is combining strings, which in PHP is simply a period operator. Process Control PHP implements a very basic set of process control statements, which behave in the usual fashion. They are the familiar If statement, While loop, For loop, Case block (switch), the Foreach loop, and the break and continue. The syntax is a little different. Where I have {code} below it means any line or lines of PHP code including the curly brackets. Each line must end with a semicolon ;. The brackets group the lines into a unit. For example, the {code} after the If statement or While statement can be either a single line with a semicolon without brackets, or one or more lines with brackets. The continue command which skips the rest of the current loop iteration, has an added feature: add a number to skip the rest of nested loops. For example, continue 2 skips the current iteration and also a loop enclosing the current loop. if ($A=="value") {code} If statement to execute the bracketed code. Use === three equals to test boolean values while ($A=="value"){code} While loop executing the bracketed code for ($i = 1; $i <= 10; $i++) {code} The for loop is just like in C. Increment $i and iterate foreach ($A as $V) {code} when $A is an array, loops through the array for each value $V assigning the value to $V on each iteration foreach($A as $key=>$V) if you need to access the array element and not just the value, include 'scriptfilename' inserts the contents of a file into code The Arithmetic, logical and boolean operators are exactly as one would expect and listed below to round out this reference: Arithmetic
Bill Hamilton is a former Database Administrator for United News and Media, and VNU inc. He currently operates several php/mysql driven websites including www.mysticgemcreations.com
Rate this Article:
Current: 5 / 5 stars - 2 vote(s).
Article Tags: Programming, Tutorial, Quick Start, Scripting, Php5, Reference Card Article Source: http://www.articlesbase.com/programming-articles/selftaught-php-string-functions-quick-start-445895.html About the Author:Bill Hamilton is a former Database Administrator for VNU inc. and United News and Media, Network Systems Engineer, and Application Developer. He owns and operates several websites including Gems, Beads and Crystals
Related ArticlesTurning Visitors Into Customers Latest Web Development Features for Zend Framework Marketing Research Tips: Gathering Requirements Precautions for Software Outsourcing Php Vs .net New Futures to Website Design - Development - Hosting - SEO Programming With PHP the Right Way People Still Cling To Their Unappreciated Cars Got a Question? Ask.Ask the community a question about this article:Frequently Asked Questions Parsing HTML with PHP How to retrieve data on the data table? How to create a slider custom control in C# ? Is there someone that can change my working ... HTML training Where can I find a stock market simulator? Latest Programming ArticlesCool Desktop Wallpapers Tips for Buying Software Online Mvc Design Pattern Advantages of Low Cost Contract Programmers in Freelance Programming A Guide to Cnc Kits A Guide to Cnc Tube Bending Machines Ways to Hire Dedicated Php Programmers Top 4 Reasons Why Addressing Web Accessibility is Important More from Bill HamiltonSelf-taught Php/mysql: a Simple Page Counter Tutorial |
||||||||
|
Article Categories
|
||||||||
|
|
||||||||