PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

strstr> <strrpos
Last updated: Sun, 25 Nov 2007

view this page in

strspn

(PHP 4, PHP 5)

strspn — Βρείτε το μήκος του αρχικού κομματιού που ταιριάζει στη μάσκα

Περιγραφή

int strspn ( string $str1 , string $str2 )

Επιστρέφει το μήκος του αρχικού τμήματος της παραμέτρου str1 που αποτελείται στο σύνολό του από χαρακτήρες του string str2 .

Η ακόλουθη γραμμή κώδικα:

<?php
$var 
strspn("42 is the answer, what is the question ...""1234567890");
?>
θα θέσει το 2 ως τιμή της $var, επειδή το string "42" θα είναι το μεγαλύτερο τμήμα που περιέχει χαρακτήρες από το "1234567890".

Ανατρέξτε επίσης στην strcspn().



add a note add a note User Contributed Notes
strspn
B Crawford
02-Oct-2007 05:20
This function is significantly faster for checking illegal characters than the equivalent preg_match() method.

strstr> <strrpos
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites