Search code examples
phpheaderfacebook-php-sdk

Is header with string keyword new in PHP?


In one of YouTube tutorial I came across this

header( string: 'location: login.php' );

It issues a syntax error on ':' for me but works fine for him. This works fine for me without 'string:' but wants to know the reason.

This code is used for FB login plugin in this tutorial. Here's the link https://youtu.be/1DgzTWr3F2I

19:00 min

My PHP version is 5.6.24


Solution

  • That string: is just an IDE helper to tell you that the parameter expected is called string, it's not actually in the code.

    Let me guess, is the tutorial person using IntelliJ Idea or PhpStorm? They implemented it this year

    About the second error, the -> sign must not have spaces between the method and the object.