parse-error

PHP code only works when enclosed in short open tags

回眸只為那壹抹淺笑 提交于 2019-12-25 12:17:13
问题 I have a PHP file which was working fine until last tuesday, I last-edited it a month ago so I don't know what made it stop working. I changed the file to just echo a string: <?php echo "5"; ?> but it returns: Parse error : syntax error, unexpected '"5"' (T_CONSTANT_ENCAPSED_STRING) in file.php on line 1 Then just store a variable: <?php $var = 2+3; ?> And it returns: Parse error : syntax error, unexpected '$var' (T_VARIABLE) in file.php on line 1 There are no whitespaces, everything you see

Parse Error during insert event in google calendar api

旧街凉风 提交于 2019-12-25 12:09:32
问题 I've a json object below and passed it as urlParameter { "end": { "dateTime": "2017-10-09T13:30:00", "timeZone": "America/Denver" }, "start": { "dateTime": "2017-10-09T12:00:00", "timeZone": "America/Denver" }, "description": "Added through API", "summary": "Lecture on Global Warming", "location": "Denver" } I've also set the Content-Type as application/json . But I get the error as { "error": { "errors": [ { "domain": "global", "reason": "parseError", "message": "Parse Error" } ], "code":

“Parse error: syntax error, unexpected $end” For my uni registration assignment [closed]

我的梦境 提交于 2019-12-24 13:07:48
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I am new to php so I used a Youtube tutorial to create this script, however the uploader seems to have disappeared so I cannot ask him any questions. My

Haskell Multi-line Lambdas

一世执手 提交于 2019-12-24 03:26:28
问题 I am learning Haskell from learnyouahaskell.com and there is an example such that: search :: (Eq a) => [a] -> [a] -> Bool search needle haystack = let nlen = length needle in foldl (\acc x - > if take nlen x == needle then True else acc) False (tails haystack) But when tried this code with GHC, it gives me error: parse error on input ‘-’ But it works when it is like this: search :: (Eq a) => [a] -> [a] -> Bool search needle haystack = let nlen = length needle in foldl (\acc x -> if take nlen

Why parse error? Indentation?

牧云@^-^@ 提交于 2019-12-23 17:01:06
问题 I wrote this code: addNums key num = add [] key num where add res a:as b:bs | a == [] = res | otherwise = add res:(a+b) as bs At line 3 the interpreter says: parse error (possibly incorrect indentation) I could not find something wrong, neither with the code nor with the indentation. I put four spaces for each tab. Annotation: Even this does not compile: addNums key num = add [] key num where add res a:as b:bs | a == [] = res | otherwise = add res:(a+b) as bs Line 2: Parse error in pattern:

Haskell - defining a function with guards inside a 'where'

这一生的挚爱 提交于 2019-12-21 07:08:25
问题 I'm just starting out at teaching myself Haskell. This code is supposed to do prime factorisation: divides :: Integer -> Integer -> Bool divides small big = (big `mod` small == 0) lowestDivisor :: Integer -> Integer lowestDivisor n = lowestDivisorHelper 2 n where lowestDivisorHelper m n | (m `divides` n) = m -- these should belong to lowestDivisorHelper | otherwise = lowestDivisorHelper (m+1) n primeFactors :: Integer -> [Integer] primeFactors 1 = [] primeFactors n | n < 1 = error "Must be

Haskell: parse error on input 'putStrLn'

若如初见. 提交于 2019-12-20 02:09:30
问题 I just wrote my first Haskell program, but there is an error that I cannot understand. I think it is right because I just wrote it like the example from a book. Could anyone help me please? main = do putStrLn "Hello, what's your name?" name <- getLine putStrLn ("Hey" ++ name ++ ", nice to meet you!") The error message is: parse error on input 'putStrLn' It is strange. 回答1: Though it's impossible to tell from your posted code because SO converts tabs to spaces at least some of the time, the

Why complains Haskell parse error on input `|' in this Function?

一世执手 提交于 2019-12-18 09:49:38
问题 I was supposed to write a little function in Haskell, which should erase elements, which are twice in the list. Unfortunately, Haskell complains " parse error on input `|' ". Could anyone help me with that? makeSets=mSet[]s where mSet stack []=stack mSet stack (x:xs) |contains stack x=mSetstack xs | otherwise =mSet (x:stack) xs where contains [] thing=False contains (x:xs)thing | x==thing=True |otherwise=contains xs thing 回答1: You are mixing tabs and spaces, which is no good when indentation

jQuery 1.5.1 breaks all ajax() calls

你说的曾经没有我的故事 提交于 2019-12-17 14:49:55
问题 When I upgrade to jQuery 1.5.1 (or 1.5) all of the ajax() calls in my site produce a "parserror" in the error option function. There is also a script error Uncaught SyntaxError: Unexpected token : jquery-1.5.1.min.js:16 The site has been running w/o errors using 1.4.4. Here is code from one of the ajax() calls. $.ajax({ url: '/CustomerGroup/Get', type: 'POST', contentType: 'application/json; charset=utf-8', dataType: 'json', success: function (grp) { if (grp != null) { clear(); group = grp;

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

人走茶凉 提交于 2019-12-17 14:01:21
问题 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(); 回答1: Your code uses anonymous functions which were supported in PHP 5.3. So, you need