0

So I got the following code which was working totally fine in php 5.6:

<?php
$post = array();
$team = array();

$priority = array(
    "normal" => "",
    "low" => "",
    "high" => "", ...

However, I recently got a new server which is running php 7.0, and my script does not work at all. Everything after the first => is output as plain text.

I tested this with another array i called $testarray. So the code is:

$post = array();
$team = array();

$testarray = array(
    'test' => 1,
    'asdf' => 2
);

$priority = array(
    "normal" => "",
    "low" => "",
    "high" => "", ...

The output in that case is:

1, 'asdf' => 2 ); $priority = array( "normal" => "", "low" => "", "high" => "", ...

So obviously, php7.0 has troubles with processing this associative array. I know that the code is valid since it runs perfectly fine on my localhost which is still running php 5.4. I also don't want to downgrade now because I really like to be up to date with modern technology. And I really doubt php 7.0 does not support associative arrays anymore.

What to I have to do in order to run the above code properly?

Realitätsverlust
  • 3,941
  • 2
  • 22
  • 46
  • Are you sure you show us the correct code and you also look at the correct output? Do you call the file over the server? Can you reproduce the error in another environment which is freshly set up? – Rizier123 Jun 08 '16 at 15:10
  • This is 100% the correct code. And yes, I call the file via `xx.xx.xx.xx/my-folder`, since this is the `index.php`, it's called automatically. And no, I can't reproduce the error in my localhost environment which is still running php 5.6 tho. – Realitätsverlust Jun 08 '16 at 15:13
  • 2
    You don't call the file over the server and so `` it ends the tag and you get that output. – Rizier123 Jun 08 '16 at 15:15
  • @Rizier123 Makes sense, I just checked and there is the setting in the httpd.conf missing. Didn't evne think about that. Tyvm. – Realitätsverlust Jun 08 '16 at 15:20

0 Answers0