Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!not-for-mail From: "M. Strobel" Newsgroups: comp.lang.php Subject: Re: adding a method to a built-in class ? Date: Tue, 30 Oct 2012 13:38:59 +0100 Lines: 19 Message-ID: References: <508fc27f$0$1948$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de 5F08pCsbz3tk0n6lqBS9DAZjaUGdX7x+AzyAJ6spHGlnJRfSmWB7ohf1ChvS4X1E8= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 In-Reply-To: <508fc27f$0$1948$426a74cc@news.free.fr> Xref: csiph.com comp.lang.php:7401 Am 30.10.2012 13:05, schrieb Une B=C3=A9vue: > newbie to php5, i'd like to know if i could add a method to a built-in = class. >=20 > The purpose is to ass #to_sql() method to the String class. >=20 > #to_sql() would just replace any oiccurence of the character "'" by two= of it "''". It looks like you want to program your own sql parameter substitution. Yo= u should rather use the functions like mysqli::real_escape_string(), PDO::quote(),= or use prepared statements. /Str.