I'm displaying an events list from my Eventbrite account and when run locally, it works. When I upload it to my live test site, it triggers:
Parse error: syntax error, unexpected T_FUNCTION in ... on line ...
My PHP is as follows and pretty much verbatim from https://github.com/ryanjarvinen/eventbrite.php/blob/master/examples/event-list-example.md
<?php
include "Eventbrite.php";
$authentication_tokens = array('app_key' => 'XXXXXXXX',
'user_key' => '123456789');
$eb_client = new Eventbrite( $authentication_tokens );
$events = $eb_client->user_list_events();
$custom_render_function = function($evnt){
$time = strtotime($evnt->start_date);
if( isset($evnt->venue) && isset( $evnt->venue->name )){
$venue_name = $evnt->venue->name;
}else{
$venue_name = 'online';
}
$event_html = "<div class='eb_event_list_item' id='evnt_div_" . $evnt->id ."'>
<span class='eb_event_list_date'>" . strftime('%a, %B %e', $time) . "</span>
<a class='eb_event_list_title' href='" . $evnt->url."'>".$evnt->title."</a>
<span class='eb_event_list_time'>" . strftime('%l:%M %P', $time) . "</span>
<span class='eb_event_list_location'>" . $venue_name . "</span>
</div>\n";
return $event_html;
}
?>
<?= $event_list_html = Eventbrite::eventList( $events, $custom_render_function); ?>
Can anyone help me see where I've gone wrong?
UPDATE: It was the version of PHP on the server (5.3). Mine had to be updated by the hosting service but it took only 30secs and this issue was resolved.