iamthewalrus iamthewalrus - 11 months ago 53
PHP Question

Parse error: syntax error after inputting API info and tokens

After updating the web app with Instagram and twitter client id, secret and tokens,

I encountered parser and syntax error on line 1 of the following script. I suspect there is a PHP version conflict. How do I fixe this? Thanks.

function stream_for($resource = '', array $options = [])
if (is_scalar($resource)) {
$stream = fopen('php://temp', 'r+');
if ($resource !== '') {
fwrite($stream, $resource);
fseek($stream, 0);
return new Stream($stream, $options);

Answer Source

your function should be

function stream_for($resource = '', $options = array()){
//rest here

but yours is valid for 5.4.0+