Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61378 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95717 invoked from network); 17 Jul 2012 20:00:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2012 20:00:57 -0000 Authentication-Results: pb1.pair.com header.from=alex.aulbach@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=alex.aulbach@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: alex.aulbach@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:61911] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/F7-54353-674C5005 for ; Tue, 17 Jul 2012 16:00:55 -0400 Received: by pbbrp12 with SMTP id rp12so1397822pbb.29 for ; Tue, 17 Jul 2012 13:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=6Zy2OF/32lb5zYavk2OFH2det1r8h+v5veZRZ61/cGI=; b=tMsNNKnY3+kexBGh6lnPbszFa/UUuzZ+FIv0hJVS5ogsSnWSnRKV+eBEr53v4rJX0Y oe/UkUnDTUBNY64XCbb8Q1owD/hp/3jYGVqELjDGGxquaGtPdWc7l0rOeQMyuYPhFt9E 1Na5hc0Kl1Egzdwf7KRZ9zniU5KHmdAAvgHuWuDy94EXfVPIZDw7TG5tUd2lIjcWi70G Tm82pahQY9gYUiE2BOZ3pA+JfyRre6O8N2oo1xsIsvfqKPdwUfrnnwfMvWyFCUYCcpKh 84sj3KsDUG9RO7dvEs591g0W8VPHz0BKgwbI5PA80hkkAZSey+lztnA06tl0URji1Aae m0yA== MIME-Version: 1.0 Received: by 10.68.226.38 with SMTP id rp6mr1294172pbc.90.1342555251949; Tue, 17 Jul 2012 13:00:51 -0700 (PDT) Received: by 10.68.31.7 with HTTP; Tue, 17 Jul 2012 13:00:51 -0700 (PDT) In-Reply-To: <500592AE.4060305@gmail.com> References: <5004775D.601@gmail.com> <500592AE.4060305@gmail.com> Date: Tue, 17 Jul 2012 22:00:51 +0200 Message-ID: To: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= Cc: Anthony Ferrara , Andrew Faulds , Nikita Popov , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: =?ISO-8859-1?Q?Re=3A_=5BPHP=2DDEV=5D_Random_string_generation_=28=E1_la_passwo?= =?ISO-8859-1?Q?rd=5Fmake=5Fsalt=29?= From: alex.aulbach@gmail.com (Alex Aulbach) 2012/7/17 =C1ngel Gonz=E1lez : > Those could be in the flag. The / are not really needed, they are an > additional syntax over regex provided by PHP (and the character can be a = different makes it a little bit like Perl. I see this as a "standard". So for me a regex is with delimiters, even if the lib doesn't need them. > one, although usually / is picked). Think, it comes from SED. I usaly use '#' - better visibility. :) > The above code doesn't support POSIX character classes, just picking > characters out of a string (which I agree is simple). PCRE uses the Posix classes... [btw. off topic: I read thrugh http://www.pcre.org/pcre.txt - meiomei, they have introduced things here... "backtracking control", "path recording"... incredible] >> // Search spacer strings >> strpbrk ("Hello World", str_charset('/[\s]/')); > So you're expanding all spacing characters, then iterating over them > with strpbrk(), > a preg_match() would have been more efficient. Of course. Every example could be done more efficient with regex. It's not the point! Once used, str_charset() is "ready", the result can be cached and reused for much more things. And then it's faster than pcre, even ready compiled. Hm. Maybe back to the roots? Using range() is not so complicated: implode('', array_merge( range('a','z'), range('A','Z'), range('0','9')) )) So I think, if we don't need charset-encoding, we won't need this special functionality. --=20 Alex Aulbach