• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

Parse error: syntax error, unexpected T_FUNCTION

Hi there Im getting this error highlighted on line 194 which is the top line of this code

 
curl_setopt($c, CURLOPT_HEADERFUNCTION, function($c, $header) use(&$r)
			{
				if(strstr($header, ":"))
				{
					$h = explode(": ", $header);

					$key = $h[0];

					array_shift($h);

					$r->header_list[$key] = str_replace("\r\n", '', implode(": ", $h));
				}

				return strlen($header);
			});

Open in new window


Can anyone help please?
0
MayoorPatel
Asked:
MayoorPatel
  • 2
1 Solution
 
hernst42Commented:
Are you sure you run this code on PHP 5.3? PHP 5.2 does not support lamda functions
0
 
MayoorPatelAuthor Commented:
I have PHP Version 5.2.6 should I get my host to upgrade?
0
 
hernst42Commented:
EIther upgrade to PHP 5.3 or rewrite the code so it works with php 5.2. See http://www.php.net/manual/en/functions.anonymous.php
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now