-3

I was wondering how come the php function list() does not works on Max OSx but on Windows it does.

list($songAuthor, $songName, $songDate, $songSummary, $songPic, $songLyrics) = split(";", $data, 6);

I'm trying to parse a string $data into six different variables.

My PHP version is 7.0.8.

How can i make the code run in my Mac OSx?

1
  • 1
    In the future, please indicate what "does not works" means. Error messages? Unexpected function? etc.
    – ceejayoz
    Aug 30, 2016 at 18:05

1 Answer 1

9

The problem is not specific to Mac OSX, but to PHP7.

PHP7 removed split() function - it had been deprecated for some time now.

Warning This function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.

Try explode() instead which performs nearly same function (parsing string instead of regexp) and which generally leads to same results:

list($songAuthor, $songName, $songDate, $songSummary, $songPic, $songLyrics) = explode(";", $data, 6);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.