Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53784 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64453 invoked from network); 8 Jul 2011 14:12:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jul 2011 14:12:03 -0000 Authentication-Results: pb1.pair.com header.from=confik@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=confik@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.170 as permitted sender) X-PHP-List-Original-Sender: confik@gmail.com X-Host-Fingerprint: 209.85.160.170 mail-gy0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:53005] helo=mail-gy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/82-48961-130171E4 for ; Fri, 08 Jul 2011 10:12:02 -0400 Received: by gyb13 with SMTP id 13so899814gyb.29 for ; Fri, 08 Jul 2011 07:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=SEF4AxHPzbxppu83+GhhckQid1xp5WRjdFy7dxvUrio=; b=X9D0pohuNNrGu2SwDwgJ4Ik6YmXrQ0Cw0bjXOtD4Pt9ryUJovTdX4V7LnDGDdoMx0+ Jia7KJ3MeNDzwSxQXgQE9UhHSIFAl1AEy9CeykA8UEU/OpJfSU+zbE1jH/qHn9pAA27G 5SbwcAsqdtCBp+ldsE5MIYJRuTgbKQEagoxGo= Received: by 10.91.186.19 with SMTP id n19mr431808agp.48.1310134319110; Fri, 08 Jul 2011 07:11:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.90.69.4 with HTTP; Fri, 8 Jul 2011 07:11:38 -0700 (PDT) In-Reply-To: References: <4E170999.7040701@hoa-project.net> Date: Fri, 8 Jul 2011 19:11:38 +0500 Message-ID: To: Rafael Dohms Cc: ivan.enderlin@hoa-project.net, Nikita Popov , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] preg_match From: confik@gmail.com (Alexey Shein) 2011/7/8 Rafael Dohms : > Still, this is preg_match it only returns one match, why should i get > a array and have to use ugly things like $matches[0] afterwards? > It just makes for very ugly syntax and extra code, a simple function > would make this cleaner and more intuitive, first time using > preg_match is a nightmare. > You forget about subpatterns, so array can contain more than 1 value: php > preg_match('/p(hp)/', 'php', $matches); var_dump($matches); array(2) { [0]=> string(3) "php" [1]=> string(2) "hp" } > -- > Rafael Dohms > PHP Evangelist and Community Leader > http://www.rafaeldohms.com.br > http://www.phpsp.org.br > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Regards, Shein Alexey