<?php
interface SlugifierInterface
{
/**
* Return a URL safe version of a string.
*
* @param string $string
* @return string
*/
public function slugify($string);
}
class Sluggifier implements SlugifierInterface
{
public function __construct()
{
}
public function slugify($string)
{
return "I am from" . $string;
}
}
echo Sluggifier::slugify("Hello World");
$sluggifier = new Sluggifier();
echo $sluggifier->slugify("Hello World from object");
Fatal error: Uncaught Error: Non-static method Sluggifier::slugify() cannot be called statically in /in/McWf4:25
Stack trace:
#0 {main}
thrown in /in/McWf4 on line 25
Process exited with code 255.
Deprecated: Non-static method Sluggifier::slugify() should not be called statically in /in/McWf4 on line 25
I am fromHello WorldI am fromHello World from object
Output for 7.3.32 - 7.3.33
I am fromHello WorldI am fromHello World from object
Strict Standards: Non-static method Sluggifier::slugify() should not be called statically in /in/McWf4 on line 25
I am fromHello WorldI am fromHello World from object
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/McWf4 on line 2
Process exited with code 255.