Expect approval?

I created a file containing common functions. The purpose of this file is to include it in the main file and use the functions available in it.

Anyway, at the top of everything, so <?phpPhpStorm Return:

Waiting for a line

What means?

file structure example:

<?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 did I do wrong?

+4
source share
3 answers

Your problem is that you defined it as a function publicwhen you are outside the class.

Just change

public function getTimeStamp()

to

function getTimeStamp()
+18
source

try it

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

you forgot to skip. "in the new DateTime () you get the wrong string.

0
source

, . . :

class bob {

   public function process(){

      // bunch of code here

       protected function hello() {
           //wrong spot!
       }
   }
}
0

Source: https://habr.com/ru/post/1627272/


All Articles