JavaScript Editor Ajax software     Free javascripts 

Main Page

Some of these flags are used in later chapters as well.
commands are processed in sequential order as they are written in the configuration file.
If you want to make sure that a rule is the last one processed in case a match is found for it, you need to
use the
flag as listed in the preceding table:
RewriteRule ^Products/P([0-9]*)\.html$ ./product.php?product_id=$1
This is particularly useful if you have a long list of
commands, because using
performance and prevents mod_rewrite from processing all the
commands that follow once
a match is found. This is usually what you want regardless.
URL Rewriting and PHP
Regular expressions are also supported by PHP. Whenever you need to do string manipulation that is
too hard to implement using the typical PHP string functions (
), the
regular expression functions can come in handy, as soon as you get accustomed to working with regular
PHP has many regular expression functions, the most common of which are listed in Table 3-5 for your
convenience. The examples in this book use only
, which are the most
frequently used, but it’s good to know there are others. For more information, visit
Table 3-5
PHP Function
Receives as parameters a regular expression, and an array of input
strings. The function returns an array containing the elements of the
input that match the pattern. More details at
Receives as parameters a regular expression and a string. If a match
is found, the function returns 1. Otherwise, it returns 0. The function
doesn’t search for more matches: after one match is found, the execu-
tion stops. More details at
One detail worth keeping in mind is that the regular PHP string manipulation
functions execute much faster than regular expressions, so you should use them
only when necessary. For example, if you simply want to check whether one string
literal is included in another, using
would be much more
efficient than using
Chapter 3: Provocative SE-Friendly URLs
c03.qxd:c03 10:39 60

JavaScript Editor Ajax software     Free javascripts 
Bitcoin Dice - Crypto Casino . View here