PHP

PHP Menu

PHP

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

Definition

The str_split() function splits a string into an array.

Syntax

str_split(string, length)

Parameters

Parameter Description
string Required. Specifies the string to split.
length Optional. Specifies the length of each array element. Default is 1.

Example

<?php
print_r(str_split("Welcome to PHP")); echo "<br>"; print_r(str_split("Welcome to PHP", 7));

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods