Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [0]=>string == "45"
- [1]=>string == "test-sample"
- print_r(explode('-', $string, 2)); // take some help from the limit parameter
- Array
- (
- [0] => 45
- [1] => test-sample
- )
- $array = explode('-', $text, 2);
- $str = "45-test-sample";
- $arr = explode('-', $str, 2);
- print_r($arr);
- Array
- (
- [0] => 45
- [1] => test-sample
- )
- <?php
- $str = "45-test-sample";
- list($a,$b) = explode('-', $str, 2);
- $arr=Array();
- $arr=['0'=>"String == ".$a,'1'=>"String == ".$b];
- print_r($arr);
- Array
- (
- [0] => String == 45
- [1] => String == test-sample
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement