Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Add support for older PHP 5.x.x versions #14

merged 1 commit into from

2 participants


This PR adds support for older PHP 5 versions (<5.3.0). Older versions threw the following error when including the main Soundcloud.php library file.

syntax error, unexpected T_FUNCTION, expecting ')' in /path/to/Soundcloud.php

This is also described in this StackOverflow question.

The root cause is that array_map only supports lambda functions as of PHP 5.0.3. This PR replaces this method with a simple foreach.

@mptre mptre merged commit d30406a into mptre:master

Thx, merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 17, 2013
  1. @por
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 Services/Soundcloud.php
8 Services/Soundcloud.php
@@ -717,9 +717,11 @@ function download($trackId, $params = array(), $curlOptions = array())
public function updatePlaylist($playlistId, $trackIds, $optionalPostData = null)
$url = $this->_buildUrl('playlists/' . $playlistId);
- $postData = array_map(function ($track) {
- return 'playlist[tracks][][id]=' . $track;
- }, $trackIds);
+ $postData = array();
+ foreach ($trackIds as $trackId) {
+ $postData[] = 'playlist[tracks][][id]=' . $trackId;
+ }
if (is_array($optionalPostData)) {
foreach ($optionalPostData as $key => $val) {
Something went wrong with that request. Please try again.