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 tag is used to add lists into <ul> and <ol> elements?
<dt> <dd> <li>
Which value of the "display" property creates a block box for the content and ads a bullet marker?
block list-item inline-block
.some_class {
  display: list-item;
Which instruction converts a JavaScript object into a JSON string.
JSON.parse() JSON.stringify eval()
var obj = {
 "courses": ["php", "javascript", "ajax"]
var jsonstr = JSON.stringify(obj);
alert(jsonstr);    // {"courses":["php","javascript","ajax"]}
Indicate the PHP class used to work with HTML and XML content in PHP.
stdClass PDO DOMDocument
$strhtml = '<body><div id="dv1"></div></body>';
$dochtml = new DOMDocument();
$elm = $dochtml->getElementById("dv1");
echo $elm->nodeValue;    //
Chaining Static and Public Methods in PHP

Last accessed pages

  1. Paragraphs, Line break, Horizontal rule (1571)
  2. Zuma Deluxe (1621)
  3. Mahjong Gardens (305)
  4. Bubbles3 (1466)
  5. Mahjong Games (1750)

Top accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (45791)
  2. Read Excel file data in PHP - PhpExcelReader (34450)
  3. PHP-MySQL free course, online tutorials PHP MySQL code (34339)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (30919)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (28165)