Search code examples
phpphpstorm

Expecting statement?


I have created a file that contains general functions. The goal of this file is include it inside the main file and use the functions available in it.

Anyway at the top of all, so <?php PhpStorm return:

Expecting Stament

what does mean?

an example of the file structure:

<?php //here the problem


public function getTimeStamp()
{
    $originalTime = microTime(true);
    $micro = sprintf("%06d", ($originalTime - floor($originalTime)) * 1000000);
    $date = new DateTime(date('d-m-Y H:i:s' . $micro, $originalTime));

    return $date->format($this->settings['dateFormat']);

} //and also here

 ...

?>

what I did wrong?


Solution

  • Your problem is that you have defined it as a public function when you are outside of a class.

    Simply change

    public function getTimeStamp()
    

    to

    function getTimeStamp()