note 93217 added to function.str-split

From: Date: Fri, 28 Aug 2009 18:51:35 +0000
Subject: note 93217 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-160002@lists.php.net to get a copy of this message
The manual don't says what is returned when you parse a different type of variable. This is the example: <?php $str1 = "Long"; // More than 1 char $str2 = "x"; // Only 1 char $str3 = ""; // Empty String $str4 = 34; // Integer $str5 = 3.4; // Float $str6 = true; // Bool $str7 = null; // Null $spl1 = str_split($str1); $spl2 = str_split($str2); $spl3 = str_split($str3); $spl4 = str_split($str4); $spl5 = str_split($str5); $spl6 = str_split($str6); $spl7 = str_split($str7); echo count($spl1); // 4 echo count($spl2); // 1 echo count($spl3); // 1 echo count($spl4); // 2 echo count($spl5); // 3 echo count($spl6); // 1 echo count($spl7); // 1 print_r($spl1); print_r($spl2); print_r($spl3); print_r($spl4); print_r($spl5); print_r($spl6); print_r($spl7); /* Array ( [0] => L [1] => o [2] => n [3] => g ) Array ( [0] => x ) Array ( [0] => ) Array ( [0] => 3 [1] => 4 ) Array ( [0] => 3 [1] => . [2] => 4 ) Array ( [0] => 1 ) Array ( [0] => ) */ ?> ---- Server IP: 187.16.23.128 Probable Submitter: 189.19.25.153 ---- Manual Page -- http://www.php.net/manual/en/function.str-split.php Edit -- https://master.php.net/note/edit/93217 Del: integrated -- https://master.php.net/note/delete/93217/integrated Del: useless -- https://master.php.net/note/delete/93217/useless Del: bad code -- https://master.php.net/note/delete/93217/bad+code Del: spam -- https://master.php.net/note/delete/93217/spam Del: non-english -- https://master.php.net/note/delete/93217/non-english Del: in docs -- https://master.php.net/note/delete/93217/in+docs Del: other reasons-- https://master.php.net/note/delete/93217 Reject -- https://master.php.net/note/reject/93217 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160002) next »