0

I have a PHP page that I use to perform some tasks. This page reloads every minute. Along with this page it works in conjunction with two other pages and a database. The other two pages display results based upon the main page.

I am trying to move these pages/database (application) from my main business server to another server (since it would crash my server while I was developing).

I moved everything over to the new host (same host, aiso.net, new plan), and all appeared to be functioning well. The two display pages connected with the database and worked well. However, the main page that reloads is generating an error:

Parse error: syntax error, unexpected '>'

The part of the page causing the error is this:

usort($NewArray, function($a, $b) {
    return $a['volume'] <=> $b['volume'];
});

I checked to ensure that all the PHP settings are the same between the two hosting plans.

I can't figure out why the <=> operator works fine on one host, but on the other host (with the same settings), that operator causes an error.

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
Mike Page
  • 9
  • 1
  • 2
    What version of PHP is the new plan configured to use? – Chris Forrence Jan 22 '18 at 21:39
  • I can switch between versions. The page is currently working on a version 7.0.26 site. My options are: 4.4, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2. I believe I have tried them all. In searching for answers I did find that the spaceship operator does work very differently between versions. But, since I can set it to the exact same version that is currently working I would think that rules out a version incompatibility. – Mike Page Jan 22 '18 at 21:43
  • Checkout [**this**](http://php.net/manual/en/language.operators.comparison.php) The spaceship operator supported by PHP starting from version 7. – SaidbakR Jan 22 '18 at 21:44
  • 1
    SaidbakR, I have looked through that. Thanks for the reply though. – Mike Page Jan 22 '18 at 21:49
  • http://php.net/manual/en/migration70.new-features.php – Jay Blanchard Jan 22 '18 at 21:50
  • Jay Blanchard, I also looked at both the pages you recommend but they do not solve my issue. – Mike Page Jan 22 '18 at 21:55
  • I don't see how this question is a duplicate of the other question Jay Blanchard. If it is, could you direct me to how the other page (which I did look at prior to posting this question) solves my problem? – Mike Page Jan 22 '18 at 22:03
  • My host was able to resolve the issue. The problem did indeed have to do with the PHP version on the site. Apparently they were having an issue whereby my changing the PHP version in the control panel wasn't actually changing anything on the server. Thanks all for your assistance. FWIW Chris Forrence's comment should be marked as the answer to this question as it was pointing in the right direction. – Mike Page Jan 22 '18 at 22:23

0 Answers0