Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51771 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10406 invoked from network); 31 Mar 2011 15:46:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2011 15:46:03 -0000 Authentication-Results: pb1.pair.com header.from=philip@roshambo.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=philip@roshambo.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain roshambo.org from 74.125.83.42 cause and error) X-PHP-List-Original-Sender: philip@roshambo.org X-Host-Fingerprint: 74.125.83.42 mail-gw0-f42.google.com Received: from [74.125.83.42] ([74.125.83.42:33156] helo=mail-gw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C4/67-04048-AB1A49D4 for ; Thu, 31 Mar 2011 10:46:03 -0500 Received: by gwb17 with SMTP id 17so1172272gwb.29 for ; Thu, 31 Mar 2011 08:45:59 -0700 (PDT) Received: by 10.101.204.13 with SMTP id g13mr2150358anq.104.1301586359404; Thu, 31 Mar 2011 08:45:59 -0700 (PDT) Received: from [172.20.10.2] ([166.205.9.148]) by mx.google.com with ESMTPS id w6sm1302545anf.6.2011.03.31.08.45.56 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 31 Mar 2011 08:45:58 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii In-Reply-To: <4D94A111.7050501@moonspot.net> Date: Thu, 31 Mar 2011 09:45:52 -0600 Cc: Martin Scotta , Rasmus Lerdorf , Martin Jansen , Dan Birken , internals@lists.php.net Content-Transfer-Encoding: 7bit Message-ID: <520FB834-2614-4873-AC3B-0B2594B18471@roshambo.org> References: <4D92CC38.5040900@toolpark.com> <004301cbeee8$e54a8280$afdf8780$@com> <4D9387BE.4030808@divbyzero.net> <4D94984D.8060700@lerdorf.com> <4D94A111.7050501@moonspot.net> To: Brian Moon X-Mailer: Apple Mail (2.1082) Subject: Re: [PHP-DEV] Adding a more logical string slicing function to PHP From: philip@roshambo.org (Philip Olson) On Mar 31, 2011, at 9:43 AM, Brian Moon wrote: >>> How would str_contains() be different from strstr()? >>> >>> >> They differ in the return type > > $instr = (bool)strstr($string1, $string2); > > done. No need for a new function. Well, to be clearer: bool str_contains( haystack, needle [, case_insensitive = false ] ) string str[i]str( haystack, needle [, $before_needle = false ] ) The main differences: - Return value is a bool - No ordinal value conversions (I assume) - No === usage worries/requirements - Intuitive name Regards, Philip