Php-mysql Course

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

  public static function setData(){
    self::$url = 'https://coursesweb.net/';
    return new self;
  }

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

// accessing show() method after setData()
clsShow::setData()->show();             // https://coursesweb.net/

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

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag adds an image in web page?
<div> <img> <span>
<img src="http://coursesweb.net/imgs/webcourses.gif" width="191" height="63" alt="Courses-Web" />
Which of these CSS codes displays the text oblique?
font-style: italic; text-decoration: underline; font-weight: 500;
#id {
  font-style: italic;
}
Click on the jQuery function used to hide with animation a HTML element.
click() hide() show()
$(document).ready(function() {
  $(".a_class").click(function(){ $(this).hide("slow"); });
});
Click on the correctly defined function in PHP.
fname function() {} function fname() {} function $fname() {};
function fname($a, $b) {
  echo $a * $b;
}
Chaining Static and Public Methods in PHP

Last accessed pages

  1. Add, Change, and Remove Attributes with jQuery (46250)
  2. JavaScript code and PHP (40694)
  3. Mysql SELECT JOIN tables on two different Databases (4325)
  4. Read Excel file data in PHP - PhpExcelReader (96713)
  5. TV-Screen shape with CSS (4290)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (313)
  2. Read Excel file data in PHP - PhpExcelReader (114)
  3. The Four Agreements (94)
  4. PHP Unzipper - Extract Zip, Rar Archives (91)
  5. The Mastery of Love (84)
Chat
Chat or leave a message for the other users
Full screenInchide