|
użytkowników online: 43
|
OPINIE UŻYTKOWNIKÓW
|
Mimo, że strony WWW tworzymy już 5 lat zawsze znajdziemy coś ciekawego. Świadczy o tym chociażby nasza aktówka, w której znajduje się kilkadziesiąt porad, z których często korzystamy. Otwarta forma poradnika, czyli możliwość podrzucania tematów oraz wspólny ich rozwój, to nieoceniona pomoc. Uważam, ze abonament roczny jest niewspółmiernie niski do jakości zaprezentowanych materiałów.
Marek Kończal
Internetix.pl
|
|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
quotemeta (PHP 3, PHP 4, PHP 5) quotemeta -- Quote meta characters
User Contributed Notes26-Oct-2005 03:35
matt at bueller dot ca
08-Jul-2005 05:52
$pattern = preg_replace("/\|/", "\\|", quote_meta($pattern));
would probably be better written as:
$pattern = str_replace("|", "\\|", quote_meta($pattern));
This will more effecient (especially in tight loops) than using a regex pattern.
runesk at linpro dot no
22-Apr-2004 09:52
As this do not escapes |, you should be careful using a quotemeta'ed string as a valid regexp pattern. I ran into such a hole just now, and ended up using this code:
<?php
$pattern = preg_replace("/\|/", "\\|", quote_meta($pattern);
?>
jama at keks dot com
16-Aug-2002 05:24
function cleanersql ($text) {
return preg_replace('/([\W])/i',"\\\\\\1",$text);
}
//**
- note the escaped escape chars (\)
- add chars to preserve in this regex section: [\W*CHARS*]
- give addslashes() a try ;-)
*/
jasongodsey at hotmail dot com
06-Mar-2002 04:51
function cleansql ($text) {
$chars = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY);
$count = count($chars);
for ($c=0; $c<$count; $c++) {
$letter=$chars[$c];
if (!preg_match("/[a-zA-Z0-9]/", $letter)) {
$return .= "\\$letter";
} else {
$return .= "$letter";
}
}
return $return;
}
# I use this so quote just about everything.
# $blah='jason**$_';
# $newblah = cleansql($blah);
# print "$newblah\n";
# returns: jason\*\*\$\_
16-May-2001 12:41
This function escapes characters that have special meaning in regular expressions. preg_quote() <http://php.net/manual/en/function.preg-quote.php> has similar functionality, but is more powerful since it escapes more characters (including one user-specified character).
03-Apr-2001 09:04
qutemeta() is note for quoting meta tags, but is for quoting characters which can be misunderstanded by php or a database.
|