ManaPHP\Utility\Text::startsWith PHP Метод

startsWith() публичный статический Метод

public static startsWith ( string $haystack, string $needle, boolean $ignoreCase = false ) : boolean
$haystack string
$needle string
$ignoreCase boolean
Результат boolean
    public static function startsWith($haystack, $needle, $ignoreCase = false)
    {
        if ($ignoreCase) {
            return stripos($haystack, $needle) === 0;
        } else {
            return strpos($haystack, $needle) === 0;
        }
    }

Usage Example

Пример #1
0
 /**
  * Mwt constructor.
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     foreach (get_object_vars($this) as $field => $_) {
         if (!Text::startsWith($field, '_')) {
             $this->_fields[] = $field;
         }
     }
     if (isset($options['type'])) {
         $this->_type = $options['type'];
     }
     if (isset($options['keys'])) {
         $this->_keys = $options['keys'];
     } else {
         $this->_keys = [$this->configure->getSecretKey('mwt:' . $this->_type)];
     }
     if (isset($options['ttl'])) {
         $this->_ttl = $options['ttl'];
     }
 }
All Usage Examples Of ManaPHP\Utility\Text::startsWith