Use the third parameter ($limit) of explode. The resulting array will have $limit Elements.
list($postcode, $city) = explode(" ", $string, 2);
More Related Contents:
- How to limit items from for loop?
- PHP string explode with regular expression? [closed]
- Split a comma-delimited string into an array?
- LIMIT keyword on MySQL with prepared statement [duplicate]
- Convert backslash-delimited string into an associative array
- Pagination using MySQL LIMIT, OFFSET
- PHP explode the string, but treat words in quotes as a single word
- Convert a comma-delimited string into array of integers?
- Php multiple delimiters in explode [duplicate]
- Unexpected bracket ‘[‘ – PHP [duplicate]
- PHP: How can I explode a string by commas, but not wheres the commas are within quotes?
- Limit execution time of an function or command PHP
- Parametrized PDO query and `LIMIT` clause – not working [duplicate]
- PHP: Split string into array, like explode with no delimiter
- Explode string into array with no empty elements?
- Explode string by one or more spaces or tabs
- Add a prefix to each item of a PHP array
- Explode string on commas and trim potential spaces from each value
- Error while using PDO prepared statements and LIMIT in query [duplicate]
- PHP: Limit foreach() statement? [closed]
- How can I select rows in MySQL starting at a given row number?
- Explode a paragraph into sentences in PHP
- Prevent PHP script from being flooded
- Split a string with two delimiters into two arrays (explode twice)
- PHP/MySQL Pagination
- Is there an equivalent in C++ of PHP’s explode() function? [duplicate]
- Warning: foreach staement
- Insert multiple rows with one query MySQL
- PHP – include a php file and also send query parameters
- sum specific values in a multidimensional array (php)