parse-error

PHP Version 5.2.14 / Parse error: syntax error, unexpected T_FUNCTION, expecting ')'

試著忘記壹切 提交于 2019-11-27 15:43:11
I have a certain piece of code that I'm trying to use with PHP Version 5.2.14 . Is it incompatible?? I run the following, jailshell-3.2$ php -l /XYZ/functions.php And it gives: Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /XYZ/functions.php on line 2115 Errors parsing /XYZ/functions.php The code is: 2114 $range = array_map( 2115 function (DatePeriod $p) use ($vt2) { 2116 $res = array(); Your code uses anonymous functions which were supported in PHP 5.3. So, you need PHP 5.3 to get it to working. Upgrade your server's PHP installation. Anonymous functions, also known as

Parse error: syntax error, unexpected '[' with php 5.3 [duplicate]

爷,独闯天下 提交于 2019-11-27 05:51:23
问题 This question already has an answer here: PHP syntax for dereferencing function result 22 answers My script is working really fine on my xampp. Now I tried to upload it on the server, but it spat directly a Parse error: syntax error, unexpected '[' in my face. :( The line which its mocking about is this one: $item = $xml->xpath($path)[0]; And I have no idea what is wrong. I tried to look on the php 5.3 changelog but did not found anything about it. (Because I have 5.3 on the server, and on

Parse error: syntax error, unexpected T_FUNCTION line 10?

谁说胖子不能爱 提交于 2019-11-27 05:24:39
What is wrong with my code? I ran the code on my test server and the code worked but when I upload it to my production server I get Parse error: syntax error, unexpected T_FUNCTION in /hermes/bosweb/web013/b130/ipg.acrsflcom/darayngedbeats/gentest.php on line 10 here is my code $old = "http://darayngedbeats1.s3.amazonaws.com /mp3/CrazyMonsta2.mp3?AWSAccessKeyId=AKIAJXA36ESCLQHCB54Q&Expires=1297279906& Signature=HD36ZQE8yeTIW6JPWKMcciPTiTs%3D"; //enter the key that needs to be converted $search = array(":","?","=","&","%"); $replace = array("%3A","%3F","%3D","%26","%25"); function search

jQuery.ajax() parsererror

烂漫一生 提交于 2019-11-26 19:44:33
问题 when i try to get JSON from http://api-v3.deezer.com/1.0/search/album/?q=beethoven&index=2&nb_items=2&output=json with: (jQuery 1.6.2) $.ajax({ type: "GET", url: url, dataType: "jsonp", success: function (result) { alert("SUCCESS!!!"); }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.statusText); alert(xhr.responseText); alert(xhr.status); alert(thrownError); } }); I get: parsererror; 200; undefined; jquery162******************** was not called but with the JSON from http:/

Haskell: Parse error in pattern

送分小仙女□ 提交于 2019-11-26 16:43:12
Who likes to tell me what is wrong with this code (syntactically)? -- merge two sorted lists mergeX [] b res = b ++ res mergeX a [] res = a ++ res mergeX a:as b:bs res | a > b = mergeX as b:bs a:res | otherwise = mergeX a:as bs b:res Interpreter: Parse error in pattern: mergeX You need some parenthesis: mergeX [] b res = b ++ res mergeX a [] res = a ++ res mergeX (a:as) (b:bs) res | a > b = mergeX as (b:bs) (a:res) | otherwise = mergeX (a:as) bs (b:res) The reason is because : has a lower precedence than function application, so mergeX a:as b:bs res will be parsed as: (mergeX a):(as b):(bs res

parsererror after jQuery.ajax request with jsonp content type

情到浓时终转凉″ 提交于 2019-11-26 12:22:44
I am using jQuery Version 1.5.1 to do the following ajax call: $.ajax({ dataType: 'jsonp', data: { api_key : apiKey }, url: "http://de.dawanda.com/api/v1/" + resource + ".json", success: function(data) { console.log(data); }, error: function(jqXHR, textStatus, errorThrown) { console.log(errorThrown); console.log(textStatus); } }); The server responds with a valid json object: { "response": { "type":"category", "entries":1, "params":{ "format":"json", "api_key":"c9f11509529b219766a3d301d9c988ae9f6f67fb", "id":"406", "callback":"jQuery15109935275333671539_1300495251986", "_":"1300495252693" },

Parse error: syntax error, unexpected T_FUNCTION line 10?

Deadly 提交于 2019-11-26 11:36:34
问题 What is wrong with my code? I ran the code on my test server and the code worked but when I upload it to my production server I get Parse error: syntax error, unexpected T_FUNCTION in /hermes/bosweb/web013/b130/ipg.acrsflcom/darayngedbeats/gentest.php on line 10 here is my code $old = \"http://darayngedbeats1.s3.amazonaws.com /mp3/CrazyMonsta2.mp3?AWSAccessKeyId=AKIAJXA36ESCLQHCB54Q&Expires=1297279906& Signature=HD36ZQE8yeTIW6JPWKMcciPTiTs%3D\"; //enter the key that needs to be converted

PHP : Custom error handler - handling parse & fatal errors

≯℡__Kan透↙ 提交于 2019-11-26 10:19:24
How can i handle parse & fatal errors using a custom error handler? Simple Answer: You can't. See the manual : The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called. For every other error, you can use set_error_handler() EDIT: Since it seems, that there are some discussions on this topic, with regards to using register_shutdown_function , we should take a look at the definition of handling: To me, handling an error

Haskell: Parse error in pattern

五迷三道 提交于 2019-11-26 04:55:21
问题 Who likes to tell me what is wrong with this code (syntactically)? -- merge two sorted lists mergeX [] b res = b ++ res mergeX a [] res = a ++ res mergeX a:as b:bs res | a > b = mergeX as b:bs a:res | otherwise = mergeX a:as bs b:res Interpreter: Parse error in pattern: mergeX 回答1: You need some parenthesis: mergeX [] b res = b ++ res mergeX a [] res = a ++ res mergeX (a:as) (b:bs) res | a > b = mergeX as (b:bs) (a:res) | otherwise = mergeX (a:as) bs (b:res) The reason is because : has a