note 108922 modified in function.strspn by danbrown

From: Date: Tue, 05 Jun 2012 15:41:15 +0000
Subject: note 108922 modified in function.strspn by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-188408@lists.php.net to get a copy of this message
Quick way to check if a string consists entirely of characters within the mask is to compare strspn with strlen eg:

<?php
$path = $_SERVER['PATH_INFO'];
if (strspn($path,'/') == strlen($path)) {
 //PATH_INFO is empty
}
?> --was-- Quick way to check if a string consists entirely of characters within the mask is to compare strspn with strlen eg: $path = $_SERVER['PATH_INFO']; if (strspn($path,'/') == strlen($path)) { //PATH_INFO is empty } http://php.net/manual/en/function.strspn.php

« previous php.notes (#188408) next »