According to PHP official manual It is used to converts a string to an array.
If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1.
If the split_length length exceeds the length of string, the entire string is returned as the first (and only) array element. Syntax: array str_split ( string string [, int split_length] );
Example :
< ?php
$strW3 = "Hello w3answers";
$arrW3 = str_split($strW3 );
$arrW3 = str_split($strW3 , 3);
print_r($arrW3);
print_r($arrW3);
?>
If you will read typecasting on php, you will know more on this. <?php $str = "10"; $num = (int)$str; ?>
To concatenate strings in PHP, you use the . (dot) character. For example: $str = "String1" . "String2";
Below is a simple example of how you could return a value in a PHP function. <?php function returnme($value) { return $value; } echo returnme('hello'); // outputs: hello ?>
A simple function call <html> <body> <?php if(isset($_POST['button'])) { setValue(); // Function is called } function setValue() { echo "<br>The button property to call PHP function works"; // Your code here } ?> <input type="submit" name="button" onclick=<?php $_SERVER['PHP_SELF']; ?> /> </body> </head>
chdir() PHP function helps in changing the current directory.
<?php $str = "1234567"; $strArr = str_split($str); //split up $str by 1 character $strlen = strlen($str) - 1; //get length of $str - 1 since the $strArr starts at 0 for($i=$strlen;$i>=0;$i--) { echo $strArr[$i]; } ?>
$str = "Hello"; $nameArr=str_split($str); print_r($nameArr); echo "length: ".count($nameArr);
You can find information about the PHP split function in the official PHP documentation on php.net. This function was deprecated in PHP 5.3.0 and removed in PHP 7.0.0, so it is recommended to use explode() or preg_split() instead.
If you will read typecasting on php, you will know more on this. <?php $str = "10"; $num = (int)$str; ?>
To concatenate strings in PHP, you use the . (dot) character. For example: $str = "String1" . "String2";
Str converts a number to a string.
Explode function splits a string into an array. For example: $str="Hello, How are you? i am fine."; explode("?",$str,2); it outputs two values in an array by splitting string into two values. Before question mark is considered as first value to array and after question mark is considered as second value. Finally, Array contains two values when you print it using print_r( ) function.
in php used for one typ website
we cant use set timeout function in php because it is of java script function
Below is a simple example of how you could return a value in a PHP function. <?php function returnme($value) { return $value; } echo returnme('hello'); // outputs: hello ?>
function function_name() { .................... }
The eval() function evaluates a string as PHP code. http://us.php.net/manual/en/function.eval.php