PHP

PHP Menu

PHP

strspn() Function - Definition, Syntax, Parameters, Examples

Definition

The strspn() function returns the number of characters found in the string that contains only characters from the charlist parameter.

Syntax

strspn(string, charlist, start, length)

Parameters

Parameter Description
string Required. Specifies the string to search.
charlist Required. Specifies the characters to find.
start Optional. Specifies where in the string to start.
length Optional. Defines the length of the string.

Example

<?php
echo strspn("Welcome to PHP!", "to");

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods