In PHP, the strtok() function is used to split a string into smaller strings (marks) according to the specified delimiter, and then return the string mark; the syntax format is "strtok(string, separator)".
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
PHP strtok() is used to based on the given Delimiter marks the string into smaller parts, it takes the input string as an argument along with the delimiter (as the second argument).
Syntax
strtok(string,split)
Description | |
---|---|
string | Required. Specifies the string to be split.|
split | Required. Specifies one or more delimiting characters.
Description:
This function returns a string or a range of strings separated by the given delimiter. A sequence of strings can be found by using strtok() in a while loop.Example:
<?php $string = "Hello world !"; $token = strtok($string, " "); while ($token != false) { echo "$token<br>"; $token = strtok(" "); } ?>Output:
Hello world !Recommended learning: "
PHP Video Tutorial"
The above is the detailed content of How to use php strtok() function. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version
Useful JavaScript development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools
