POMO_Reader::str_split() WordPress Method

POMO_Reader::str_split is a WordPress method used to split a string into an array. It is typically used to split a string into an array of words, but can also be used to split a string into an array of characters.

POMO_Reader::str_split( string $string, int $chunk_size ) #


Parameters

$string

(string)(Required)

$chunk_size

(int)(Required)


Top ↑

Return

(array)


Top ↑

Source

File: wp-includes/pomo/streams.php

		public function str_split( $string, $chunk_size ) {
			if ( ! function_exists( 'str_split' ) ) {
				$length = $this->strlen( $string );
				$out    = array();
				for ( $i = 0; $i < $length; $i += $chunk_size ) {
					$out[] = $this->substr( $string, $i, $chunk_size );
				}
				return $out;
			} else {
				return str_split( $string, $chunk_size );
			}
		}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.