cvs: peardoc / make-partial.php
| From: | Martin Jansen | Date: | Tue, 15 Feb 2005 16:52:03 +0000 |
| Subject: | cvs: peardoc / make-partial.php | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-5526@lists.php.net to get a copy of this message | ||
mj Tue Feb 15 11:52:03 2005 EDT
Modified files:
/peardoc make-partial.php
Log:
* Renamed in_string() to inString() and added some basic documentation for
the function.
http://cvs.php.net/diff.php/peardoc/make-partial.php?r1=1.2&r2=1.3&ty=u
Index: peardoc/make-partial.php
diff -u peardoc/make-partial.php:1.2 peardoc/make-partial.php:1.3
--- peardoc/make-partial.php:1.2 Fri Jan 28 10:12:25 2005
+++ peardoc/make-partial.php Tue Feb 15 11:52:01 2005
@@ -1,6 +1,7 @@
#!/usr/bin/env php
<?php
/** vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
+ *
* Script to trigger partial builds of the PEAR manual
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
@@ -11,7 +12,7 @@
*
* @author Martin Jansen <mj@php.net>
* @copyright 2005 The PEAR Group
- * @version CVS: $Id: make-partial.php,v 1.2 2005/01/28 15:12:25 sean Exp $
+ * @version CVS: $Id: make-partial.php,v 1.3 2005/02/15 16:52:01 mj Exp $
*/
require_once "Console/Getopt.php";
@@ -65,7 +66,7 @@
if ($sections) {
echo "Including ". $matches[1] ."? ";
- if ($includePart = in_string($sections, $matches[1])) {
+ if ($includePart = inString($sections, $matches[1])) {
echo "YES\n";
} else {
echo "NO\n";
@@ -114,7 +115,7 @@
if ($sections) {
echo "Including ". $matches[2] ."? ";
- if ($include = in_string($sections, $matches[2])) {
+ if ($include = inString($sections, $matches[2])) {
echo "YES\n";
} else {
echo "NO\n";
@@ -167,12 +168,16 @@
}
/**
- * $needle (array) is in $haystack?
+ * Checks if one element of the first parameter is part of the second parameter
*
+ * @param array List of needles
+ * @param string Haystack
+ * @return boolean True if one of the needles is in the haystack,
+ * false otherwise.
*/
-function in_string($needle, $haystack)
+function inString($needle, $haystack)
{
- foreach ((array) $needle AS $n) {
+ foreach ((array) $needle as $n) {
if (stripos($haystack, $n) !== false) {
return true;
}