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 renders as emphasized text, displaying the text oblique?
<strong> <pre> <em>
<p>Web development courses: <em></em></p>
Which CSS property defines the space between the element border and its content?
margin padding position
h3 {
  padding: 2px 0.2em;
Click on the method which returns the first element that matches a specified group of selectors.
getElementsByName() querySelector() querySelectorAll()
// gets first Div with class="cls", and shows its content
var elm = document.querySelector("div.cls");
Indicate the PHP variable that contains data from a form sent with method="post".
if(isset($_POST["field"])) {
  echo $_POST["field"];
Chaining Static and Public Methods in PHP

Last accessed pages

  1. PHP Simple HTML DOM Parser (7994)
  2. List with JavaScript events (95)
  3. PhpSpreadsheet - Read, Write Excel and LibreOffice Calc files (10480)
  4. Ajax-PHP Chat Script (37180)
  5. SHA512 Encrypt hash in JavaScript (10431)

Popular pages this month

  1. Read Excel file data in PHP - PhpExcelReader (663)
  2. PhpSpreadsheet - Read, Write Excel and LibreOffice Calc files (551)
  3. Insert, Select and Update NULL value in MySQL (417)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (393)
  5. PHP getElementById and getElementsByTagName (374)