To chain a static and a public method through class name, for example:
The instance of the className must be returned in the staticMethod, using "return new self" .
- Code example:
class clsShow {
  public static $url;

  public static function setData(){
    self::$url = '';
    return new self;

  public function show(){
    echo self::$url;

// accessing show() method after setData()
clsShow::setData()->show();             //

• To this page: PHP Method Chaining it is a lesson with more details and examples about chaining multiple methods.

Daily Test with Code Example

Which HTML5 tag can be used to embed an external application (SWF, PDF) in web page?
<mark> <embed> <canvas>
<embed src="flash_game.swf" width="450" height="350" />
Which CSS pseudo-element adds a special style to the first line of a text?
:first-letter :before :first-line
#id:first-line {
  font-weight: bold;
  color: blue;
Click on the window object property which gets or sets the URL of current page.
window.location window.self window.status
var url = window.location;
Indicate the PHP function used to get the contents of a file or page and store it into a string.
fopen() file_put_contents() file_get_contents()
$homepage = file_get_contents("");
echo $homepage;
Chaining Static and Public Methods in PHP

Last accessed pages

  1. Qwop (59134)
  2. Remove / Get duplicate array values - Reset array keys in PHP (7486)
  3. Clear Canvas Context (3465)
  4. N (549)
  5. Inca Ball (1959)

Popular pages this month

  1. Qwop (4614)
  2. Drag Racer V3 (2236)
  3. Flash Games - Free online Games (1108)
  4. Bubbles3 (993)
  5. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (983)