Php5 Parse Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more
Syntax Error Unexpected In Php
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges php unexpected semicolon Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each
Php Parse Error Syntax Error Unexpected T_variable
other. Join them; it only takes a minute: Sign up PHP 5.3.10 vs PHP 5.5.3 syntax error unexpected '[' up vote 7 down vote favorite Is it possible that this PHP code line if ($this->greatestId()["num_rows"] > 0) works in php parse error syntax error unexpected expecting PHP 5.5 and returns an error in 5.3?? PHP Parse error: syntax error, unexpected '[' in /var/www/app/AppDAO.php on line 43 How can I change it to work under PHP 5.3? php arrays php-5.3 dereference php-5.5 share|improve this question edited Jun 18 '14 at 20:53 Sam 4,60972455 asked May 9 '14 at 13:33 dendini 1,16852154 add a comment| 3 Answers 3 active oldest votes up vote 13 down vote Array dereferencing became available in PHP 5.4 That's why syntax error unexpected codeigniter this doesn't work in PHP 5.3. So you have an extra step where you need to get the array value from your function call and then you can use it: $variable = $this->greatestId(); if ($variable["num_rows"] > 0){ // do stuff } share|improve this answer answered May 9 '14 at 13:37 John Conde 156k70289364 1 found the link: php.net/manual/en/migration54.new-features.php inside new features they say: Function array dereferencing has been added, e.g. foo()[0]. –dendini May 9 '14 at 13:38 I ran into this error yesterday, on my local env i have php5.5 and on testing 5.3 :/ thanks for answer. –Neok Oct 6 '14 at 6:17 add a comment| up vote 2 down vote You cant use like this if ($this->greatestId()["num_rows"] > 0) in PHP 5.3 ver use below code. $var = $this->greatestId(); if ($var["num_rows"] > 0){ // your code } share|improve this answer answered May 9 '14 at 13:34 Manibharathi 864314 add a comment| up vote 1 down vote As mentioned in the PHP 5.4 notes: As of PHP 5.4 it is possible to array dereference the result of a function or method call directly. Before it was only possible using a temporary variable. It's not possible to do that in PHP 5.3, you need to use a variable. share|improve this answer answered May 9 '14 at 13:39 Ozmah 35118 add a comment| Your Answer draft saved draft
here for a quick overview of the site Help Center Detailed answers to any
Php Parse Error: Syntax Error, Unexpected '[' Array
questions you might have Meta Discuss the workings and policies parse error syntax error unexpected in of this site About Us Learn more about Stack Overflow the company Business Learn more about
Syntax Error Unexpected Laravel
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow http://stackoverflow.com/questions/23565971/php-5-3-10-vs-php-5-5-3-syntax-error-unexpected is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Parse error in php5.5 but no error in php5.6 up vote 0 down vote favorite I have downloaded facebook ads sdk using composer. The autoload_static.php file is working fine on http://stackoverflow.com/questions/39911081/parse-error-in-php5-5-but-no-error-in-php5-6 my system, having php5.6: array ( 'FacebookAds\\' => 12, ), ); public static $prefixDirsPsr4 = array ( 'FacebookAds\\' => array ( 0 => __DIR__ . '/..' . '/facebook/php-ads-sdk/src/FacebookAds', ), ); public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInit8e6cb1db46baaf6145a1d53efc8ef72b::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit8e6cb1db46baaf6145a1d53efc8ef72b::$prefixDirsPsr4; }, null, ClassLoader::class); } } But, for php5.5, it is showing error: Parse error: syntax error, unexpected '.', expecting ')' in lib/vendor/facebook-ads-php-sdk/composer/autoload_static.php on line 19 Errors parsing lib/vendor/facebook-ads-php-sdk/composer/autoload_static.php How can I resolve the issue? php composer-php share|improve this question asked Oct 7 at 6:49 learner 872614 Can't see any syntax error in line 19 of that code, sorry. –arkascha Oct 7 at 6:52 Are you using php5.6? It's not showing any error in case of php5.6. –learner Oct 7 at 6:53
Sign in Pricing Blog Support Search GitHub This repository Watch 656 Star 7,312 Fork 4,188 PHPMailer/PHPMailer Code Issues 48 Pull requests https://github.com/PHPMailer/PHPMailer/issues/664 11 Projects 0 Wiki Pulse Graphs New issue PHP5.3 Parse error: syntax error, unexpected '[', expecting ')' in ./class.phpmaileroauthgoogle.php on line 54 #664 Closed ildar-aim opened this Issue Mar 23, 2016 · 8 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 3 participants ildar-aim commented Mar 23, 2016 syntax error I suppose the files should be compatible with PHP5.3 aim-server[~/tmp/PHPMailer]$ /opt/phpfarm/inst/php-5.3.29/bin/php -l class.phpmaileroauthgoogle.php PHP Parse error: syntax error, unexpected '[', expecting ')' in class.phpmaileroauthgoogle.php on line 54 Parse error: syntax error, unexpected '[', expecting ')' in class.phpmaileroauthgoogle.php on line 54 Errors parsing class.phpmaileroauthgoogle.php aim-server[~/tmp/PHPMailer]$ /opt/phpfarm/inst/php-5.3.29/bin/php -l get_oauth_token.php PHP Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in get_oauth_token.php syntax error unexpected on line 37 Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in get_oauth_token.php on line 37 Errors parsing get_oauth_token.php aim-server[~/tmp/PHPMailer]$ /opt/phpfarm/inst/php-5.3.29/bin/php -v PHP 5.3.29 (cli) (built: Oct 8 2014 11:38:06) (DEBUG) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies aim-server[~/tmp/PHPMailer]$ SDKiller commented Mar 23, 2016 @ildar-aim This particular - not https://github.com/PHPMailer/PHPMailer/blob/master/class.phpmaileroauthgoogle.php#L4 SDKiller commented Mar 23, 2016 @Synchro BTW, https://github.com/thephpleague/oauth2-client/blob/master/composer.json#L6 ildar-aim commented Mar 23, 2016 According to https://github.com/PHPMailer/PHPMailer/blob/master/README.md Class Features: Compatible with PHP 5.0 and later SDKiller commented Mar 23, 2016 https://github.com/PHPMailer/PHPMailer/blob/master/README.md#installation--loading If you want to use Google's XOAUTH2 authentication mechanism, you need to be running at least PHP 5.4, and load the dependencies listed in composer.json. ildar-aim commented Mar 23, 2016 Thank you for your clarification ildar-aim closed this Mar 23, 2016 PHPMailer member Synchro commented Mar 23, 2016 Thanks @SDKiller SDKiller commented Mar 23, 2016 Seems they released stable already with 5.5 requirements - change was introduced in thephpleague/oauth2-client@e84bf29 Makes sense to rename 5.4 branch to 5.5 branch ;) PHPMailer member Synchro commen