php split
<?php
$str = 'one,two,three,four';
// to get all of the numbers: [one, two, three, four]
$numbers1 = explode(',',$str)
// same as $str
$numbers2 = explode(',',$str,0);
// breakes the string into two parts
$numbers3 = explode(',',$str,2);
// the last result will be removed
$numbers4 = explode(',',$str,-1);
?>
<?php
// Beispiel 1
$pizza = "Teil1 Teil2 Teil3 Teil4 Teil5 Teil6";
$teile = explode(" ", $pizza);
echo $teile[0]; // Teil1
echo $teile[1]; // Teil2
// Beispiel 2
$data = "foo:*:1023:1000::/home/foo:/bin/sh";
list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data);
echo $user; // foo
echo $pass; // *
?>
$nums = ""; //Declare a variable with empty set.
$nums .= $number; //concatenate the empty string with the integer $number You can also use
$nums = $nums.$number; // this and the expression above do the same thing choose whichever you
//like.. This concatenation automatically converts integer to string
$nums[0] is now 4, $nums[1] is now 5, etc..
$length = strlen($nums); // This is the length of your integer.
$target = strlen($nums) -1; // target the last digit in the string;
$last_digit = $nums[$target]; // This is the value of 5. Last digit in the (now string)