当前位置: 首页>>代码示例>>PHP>>正文


PHP strpbrk函数代码示例

本文整理汇总了PHP中strpbrk函数的典型用法代码示例。如果您正苦于以下问题:PHP strpbrk函数的具体用法?PHP strpbrk怎么用?PHP strpbrk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了strpbrk函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: return_RV

 private function return_RV($str)
 {
     /*
     If the second letter is a consonant, RV is the region after the next following vowel,
     or if the first two letters are vowels, RV is the region after the next consonant, and otherwise
     (consonant-vowel case) RV is the region after the third letter. But RV is the end of the word if these positions cannot be found.
     example,
     m a c h o [ho]     o l i v a [va]     t r a b a j o [bajo]     � u r e o [eo] prezzo sprezzante
     */
     if (strlen($str) < 2) {
         return '';
     }
     //$str;
     if (in_array($str[1], $this->consonanti)) {
         $str = substr($str, 2);
         $str = strpbrk($str, implode($this->vocali));
         return substr($str, 1);
         //secondo me devo mettere 1
     } else {
         if (in_array($str[0], $this->vocali) && in_array($str[1], $this->vocali)) {
             $str = strpbrk($str, implode($this->consonanti));
             return substr($str, 1);
         } else {
             if (in_array($str[0], $this->consonanti) && in_array($str[1], $this->vocali)) {
                 return substr($str, 3);
             }
         }
     }
 }
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:29,代码来源:it_stem.php

示例2: checkChars

    /**
     * Checks for allowed characters
     * @see Zend\Validator\Barcode.AbstractAdapter::checkChars()
     */
    public function checkChars($value)
    {
        $first = $value[0];
        if (strpbrk($value, 'ABCD') !== false) {
            $first = $value[0];
            if (strpbrk($first, 'ABCD') === false) {
                // Missing start char
                return false;
            }

            $last = substr($value, -1, 1);
            if (strpbrk($last, 'ABCD') === false) {
                // Missing stop char
                return false;
            }

            $value = substr($value, 1, -1);
        }

        $chars             = $this->_characters;
        $this->_characters = '0123456789-$:/.+';
        $result            = parent::checkChars($value);
        $this->_characters = $chars;
        return $result;
    }
开发者ID:hhatfield,项目名称:zf2,代码行数:29,代码来源:Codabar.php

示例3: createEntityPrefix

 /**
  * @param string $field
  * @return string
  */
 public static function createEntityPrefix($field)
 {
     $fullField = $field;
     $prefix = $field[0];
     if (false !== ($pos = strpos($field, '_'))) {
         // snake_case
         do {
             $field = substr($field, $pos + 1);
             $prefix .= $field[0];
             $pos = strpos($field, '_');
         } while (false !== $pos);
     } else {
         // camelCase
         $camel = strpbrk($field, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
         while (0 < strlen($camel) && strlen($camel) < strlen($field)) {
             $prefix .= strtolower($camel[0]);
             $field = $camel;
             $camel = substr($camel, 1);
             $camel = strpbrk($camel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
         }
     }
     $number = 0;
     do {
         $result = $prefix . '_' . $number;
         if (!isset(self::$tableWidePrefixes[$result])) {
             self::$tableWidePrefixes[$result] = $fullField;
             break;
         } elseif (self::$tableWidePrefixes[$result] === $fullField) {
             break;
         } elseif (self::$tableWidePrefixes[$result] !== $fullField) {
             $number++;
         }
     } while (true);
     return $result;
 }
开发者ID:uvoelkel,项目名称:serverside-datatables-bundle,代码行数:39,代码来源:EntityColumn.php

示例4: sendEmail

function sendEmail($nombre)
{
    $saludo = "";
    if (strpbrk($nombre)) {
        $message = "";
    }
}
开发者ID:abelzamora,项目名称:boda,代码行数:7,代码来源:insertar.php

示例5: line

 public function line($text)
 {
     $markup = '';
     $unexaminedText = $text;
     $markerPosition = 0;
     while ($excerpt = strpbrk($unexaminedText, $this->inlineMarkerList)) {
         $marker = $excerpt[0];
         $markerPosition += strpos($unexaminedText, $marker);
         $Excerpt = array('text' => $excerpt, 'context' => $text);
         foreach ($this->InlineTypes[$marker] as $inlineType) {
             $Inline = $this->{'inline' . $inlineType}($Excerpt);
             if (!isset($Inline)) {
                 continue;
             }
             if (isset($Inline['position']) and $Inline['position'] > $markerPosition) {
                 continue;
             }
             if (!isset($Inline['position'])) {
                 $Inline['position'] = $markerPosition;
             }
             $unmarkedText = substr($text, 0, $Inline['position']);
             $markup .= $this->unmarkedText($unmarkedText);
             $markup .= isset($Inline['markup']) ? $Inline['markup'] : $this->element($Inline['element']);
             $text = substr($text, $Inline['position'] + $Inline['extent']);
             $unexaminedText = $text;
             $markerPosition = 0;
             continue 2;
         }
         $unexaminedText = substr($excerpt, 1);
         $markerPosition++;
     }
     $markup .= $this->unmarkedText($text);
     return $markup;
 }
开发者ID:mefd,项目名称:common-bundle,代码行数:34,代码来源:61f1e03ef8c234260c54ef65a39851b9.php

示例6: SetUpForm

function SetUpForm($Character)
{
    WriteHeaders();
    echo "\n    <div class = \"top\">\n\t   Music - Alex Ash and Brett Akey\n\t</div>\n    <div class = \"bigpiece\">\n\t  <div class = \"leftpiece\"> \n\t    \n         <p>";
    if (strpbrk($Character, "H")) {
        echo "<form action=? method=post>";
        DisplayButton("nextPage", "Home", "WelcomePage");
        echo "</form>";
    }
    if (strpbrk($Character, "F")) {
        echo "<form action=? method=post>";
        DisplayButton("nextPage", "Find Record", "FoundRecord");
        echo "</form>";
    }
    echo "<form action=? method=post>";
    if (strpbrk($Character, "S")) {
        echo "<input type=submit name=\"nextPage\" class=\"submit\" value=\"Save\"> ";
    }
    if (strpbrk($Character, "C")) {
        echo "<form action=? method=post>";
        DisplayButton("nextPage", "Save Changes", "ChangesMade");
        echo "</form>";
    } elseif (!strpbrk($Character, "S") && !strpbrk($Character, "H")) {
        DisplayButton("nextPage", "Create Table", "CreateTable");
        DisplayButton("nextPage", "Add Record", "EnterData");
        DisplayButton("nextPage", "Modify Record", "ModifyRecord");
        DisplayButton("nextPage", "Display Data", "DisplayData");
    }
    echo " </p>\n\t  </div>\n\t  <div class = \"middlepiece\" >\t    \n\t ";
}
开发者ID:AlexA11,项目名称:Php-Asst-2,代码行数:30,代码来源:Asst2Main.php

示例7: introspect

    /**
     * Create XML definition on an AMF service class
     *
     * @param  string $serviceClass Service class name
     * @param  array $options invocation options
     * @return string XML with service class introspection
     */
    public function introspect($serviceClass, $options = array())
    {
        $this->_options = $options;

        if (strpbrk($serviceClass, '\\/<>')) {
            return $this->_returnError('Invalid service name');
        }

        // Transform com.foo.Bar into com_foo_Bar
        $serviceClass = str_replace('.' , '_', $serviceClass);

        // Introspect!
        if (!class_exists($serviceClass)) {
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($serviceClass, $this->_getServicePath());
        }

        $serv = $this->_xml->createElement('service-description');
        $serv->setAttribute('xmlns', 'http://ns.adobe.com/flex/service-description/2008');

        $this->_types = $this->_xml->createElement('types');
        $this->_ops   = $this->_xml->createElement('operations');

        $r = Zend_Server_Reflection::reflectClass($serviceClass);
        $this->_addService($r, $this->_ops);

        $serv->appendChild($this->_types);
        $serv->appendChild($this->_ops);
        $this->_xml->appendChild($serv);

        return $this->_xml->saveXML();
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:39,代码来源:Introspector.php

示例8: checkDbPassword

	protected function checkDbPassword()
	{
		/** @global CDataBase $DB */
		global $DB;
		$password = $DB->DBPassword;
		$sign = ",.#!*%$:-";
		$dit = "1234567890";
		if(trim($password) == "")
		{
			$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_EMPTY_PASS", CSecurityCriticalLevel::HIGHT);
		}
		else
		{
			if($password == strtolower($password))
			{
				$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_SAME_REGISTER_PASS", CSecurityCriticalLevel::HIGHT);
			}
			if(strpbrk($password, $sign) === false)
			{
				$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_NO_SIGN_PASS", CSecurityCriticalLevel::HIGHT);
			}
			if(strpbrk($password, $dit) === false)
			{
				$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_NO_DIT_PASS", CSecurityCriticalLevel::HIGHT);
			}
			if (strlen($password)<8)
			{
				$this->addUnformattedDetailError("SECURITY_SITE_CHECKER_DB_MIN_LEN_PASS", CSecurityCriticalLevel::HIGHT);
			}
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:site_configuration.php

示例9: change

 public function change()
 {
     if (!isset($_SESSION['UserID'])) {
         redirect('Login/logout');
     }
     //Create new user and load its data
     $user = new User_model();
     if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) {
         redirect('Login/logout');
     }
     //If user did not load, logout the session
     if ($user->isGuest()) {
         redirect('Mainpage');
     }
     //If not a student, redirect to mainpage
     $oldpw = $this->input->post('oldpw');
     $newpw = $this->input->post('newpw');
     $newpw2 = $this->input->post('newpw2');
     if (!$user->authenticate($oldpw)) {
         $this->load->view('changePassword', array('user' => $user, 'error' => TRUE));
     } elseif ($newpw != $newpw2) {
         $this->load->view('changePassword', array('user' => $user, 'error2' => TRUE));
     } elseif (strpbrk($newpw, '!@#$%&*-+=1234567890') === FALSE || strlen($newpw) < 8) {
         $this->load->view('changePassword', array('user' => $user, 'error3' => TRUE));
     } elseif (strpbrk($newpw, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') === FALSE || strlen($newpw) < 8) {
         $this->load->view('changePassword', array('user' => $user, 'error3' => TRUE));
     } else {
         $user->setPassword($newpw);
         $user->update();
         $this->load->view('changePassword', array('user' => $user, 'success' => TRUE));
     }
 }
开发者ID:Troutzorz,项目名称:csapp,代码行数:32,代码来源:Changepassword.php

示例10: parse

/**
 * @param string $str
 * @param string $minlength
 * @param string $maxlength
 * @param int $baseerrcode
 * @return int
 */
function parse($str, $minlength = USER_MINLENGTH, $maxlength = USER_MAXLENGTH, $baseerrcode = 0)
{
    $validchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.";
    if ($str == '') {
        return 1 + $baseerrcode;
    }
    $length = strlen($str);
    if ($length < $minlength) {
        return 2 + $baseerrcode;
    }
    if ($length > $maxlength) {
        return 3 + $baseerrcode;
    }
    if (strpos($str, "__") !== false || strpos($str, "..") !== false || strpos($str, "_.") !== false || strpos($str, "._") !== false) {
        return 4 + $baseerrcode;
    }
    if (strpos($str, ".") === 0 || strpos($str, "_") === 0 || strpos($str, ".") === $length - 1 || strpos($str, "_") === $length - 1) {
        return 4 + $baseerrcode;
    }
    for ($i = 0; $i < $length; $i++) {
        if (strpbrk($str[$i], $validchars) === false) {
            return 4 + $baseerrcode;
        }
    }
    return 0;
}
开发者ID:elcodedocle,项目名称:synapp,代码行数:33,代码来源:parsers.php

示例11: resolve

 /**
  * {@inheritDoc}
  */
 public function resolve($name)
 {
     if ($this->isLfiProtectionOn() && preg_match('#\\.\\.[\\\\/]#', $name)) {
         return null;
     }
     if (strpbrk($name, '[]*?') === false) {
         //skip files that don't look like globs
         return null;
     }
     foreach ($this->getPaths() as $path) {
         $joinedPath = $path . $name;
         $glob = glob($joinedPath);
         if (count($glob)) {
             // Get the mime type of the first file and assume its the same for all the rest (not ideal).
             // @todo Maybe this could be refactored into a MimeResolver
             $filePath = current($glob);
             $file = new SplFileInfo($filePath);
             $mimeType = $this->getMimeResolver()->getMimeType($file->getRealPath());
             $asset = new GlobAsset($joinedPath);
             $asset->mimetype = $mimeType;
             return $asset;
         }
     }
     return null;
 }
开发者ID:sokac,项目名称:AssetManager,代码行数:28,代码来源:GlobPathStackResolver.php

示例12: scanpassword

 function scanpassword($password)
 {
     $lower = false;
     $upper = false;
     $specialchar = false;
     $number = false;
     $possibilities = 0;
     $special = '!@#$%&*<>-_!@#$%&*<>-_';
     for ($i = 0; $i < strlen($password); $i++) {
         if (preg_match("/[a-z]/", $password[$i]) && !$lower) {
             $possibilities += 26;
             $lower = true;
         }
         if (preg_match('/[A-Z]/', $password[$i]) && !$upper) {
             $possibilities += 26;
             $upper = true;
         }
         if (preg_match('/[0-9]/', $password[$i]) && !$number) {
             $possibilities += 10;
             $number = true;
         }
         if (strpbrk($password[$i], $special) && !$specialchar) {
             $possibilities += 15;
             $specialchar = true;
         }
     }
     $product['product'] = pow($possibilities, strlen($password)) / 4000000000;
     $product['possibilities'] = $possibilities;
     $product['quantity'] = strlen($password);
     $objPeriod = new Period();
     $product['possibilities'] = $objPeriod->mountPossibilities($product);
     return $product;
 }
开发者ID:matheusasdev,项目名称:PowerKey,代码行数:33,代码来源:scan.php

示例13: extraireMots

function extraireMots($dictee, $nbcar = 5, $mot = '')
{
    $dictee = str_replace("\n", " ", $dictee);
    $tableau = explode(' ', $dictee);
    $nbmots = count($tableau);
    $dictionnaire = [];
    foreach ($tableau as $mots) {
        $mots = rtrim($mots, ',');
        $mots = rtrim($mots, '.');
        $mots = rtrim($mots, ':');
        $mots = ltrim($mots, '"');
        if (strpbrk($mots, "-") != false) {
            $motComposes = explode('-', $mots);
            if (mb_strlen($motComposes[0]) >= $nbcar) {
                $dictionnaire[] = $motComposes[0];
            }
            if (mb_strlen($motComposes[1]) >= $nbcar) {
                $dictionnaire[] = $motComposes[1];
            }
        } elseif (mb_strlen($mots) >= $nbcar) {
            $dictionnaire[] = $mots;
        }
    }
    $motPresent = in_array($mot, $dictionnaire);
    $resultat = array($nbmots, $dictionnaire, $motPresent);
    return $resultat;
}
开发者ID:simplon-renaudV,项目名称:exosFonctions,代码行数:27,代码来源:exofonctions.php

示例14: putCSV

 /**
  * @param $handle
  * @param $fields
  * @param string $delimiter
  * @param string $enclosure
  * @param bool $useArrayKey
  * @param string $escape
  */
 public static function putCSV($handle, $fields, $delimiter = ',', $enclosure = '"', $useArrayKey = false, $escape = '\\')
 {
     $first = 1;
     foreach ($fields as $key => $field) {
         if ($first == 0) {
             fwrite($handle, $delimiter);
         }
         if ($useArrayKey) {
             $f = str_replace($enclosure, $enclosure . $enclosure, $key);
         } else {
             $field = EXPORT_ENCODE_FUNCTION != "none" && function_exists(EXPORT_ENCODE_FUNCTION) ? call_user_func(EXPORT_ENCODE_FUNCTION, $field) : $field;
             $f = str_replace($enclosure, $enclosure . $enclosure, $field);
         }
         if ($enclosure != $escape) {
             $f = str_replace($escape . $enclosure, $escape, $f);
         }
         if (strpbrk($f, " \t\n\r" . $delimiter . $enclosure . $escape) || strchr($f, "")) {
             fwrite($handle, $enclosure . $f . $enclosure);
         } else {
             fwrite($handle, $f);
         }
         $first = 0;
     }
     fwrite($handle, "\n");
 }
开发者ID:arnon22,项目名称:transportcm,代码行数:33,代码来源:FileManager.php

示例15: controller

 /**
  * Map route to all public controller method
  *
  * with
  * Route::get('/prefix', 'ClassController')
  *
  * this will map
  * GET  domain.com/prefix -> ClassController::getIndex
  * POST domain.com/prefix -> ClassCOntroller::postIndex
  * PUT  domain.com/prefix -> ClassCOntroller::putIndex
  */
 public static function controller()
 {
     $arguments = func_get_args();
     $path = $arguments[0];
     $controller = end($arguments);
     $class = new \ReflectionClass($controller);
     $controllerMethods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
     $uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     foreach ($controllerMethods as $method) {
         if (substr($method->name, 0, 2) != '__') {
             $methodName = $method->name;
             $callable = $arguments;
             $pos = strcspn($methodName, $uppercase);
             $httpMethod = substr($methodName, 0, $pos);
             $ctrlMethod = lcfirst(strpbrk($methodName, $uppercase));
             if ($ctrlMethod == 'index') {
                 $pathMethod = $path;
             } else {
                 if ($httpMethod == 'get') {
                     $pathMethod = "{$path}/{$ctrlMethod}(/:params+)";
                 } else {
                     $pathMethod = "{$path}/{$ctrlMethod}";
                 }
             }
             //put edited pattern to the top stack
             array_shift($callable);
             array_unshift($callable, $pathMethod);
             //put edited controller to the bottom stack
             array_pop($callable);
             array_push($callable, "{$controller}:{$methodName}");
             call_user_func_array(array(self::$slim, $httpMethod), $callable);
         }
     }
 }
开发者ID:thantalas,项目名称:slim-nne,代码行数:45,代码来源:RouteFacade.php


注:本文中的strpbrk函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。