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?
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()
Make sure you haven't declared a function within another function. That will cause this error as well. For example:
class bob {
public function process(){
// bunch of code here
protected function hello() {
//wrong spot!
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With