PHP

PHP Menu

PHP

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

Definition

The strtok() function splits a string into smaller strings (tokens).

Syntax

strtok(string, split)

Parameters

Parameter Description
string Required. Specifies the string to split.
split Required. Specifies one or more split characters.

Example

<?php
$str = "Welcome to the PHP Tutorials. Learn PHP quickly."; $tokens = strtok($str, " "); while ($tokens !== false) { echo "$tokens<br>"; $tokens = strtok(" "); }

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods