Late Static Binding Example

Example

class A
{
    static public $data = 'A';
    
    static public function set()
    {
        //self::$data = '--'; //normal binding
        static::$data = '--'; //late binding
    }
}

class B extends A
{
    static public $data = 'B';
}

class C extends A
{
    static public $data = 'C';
}


echo A::$data, B::$data, C::$data;
C::set();
echo A::$data, B::$data, C::$data;

normal binding

ABC--BC

late binding

ABCAB--

Wondering about LEFT JOIN evaluation in MySQL

From LEFT JOIN and RIGHT JOIN Optimization

The join optimizer calculates the order in which tables should be joined.

 

MySQL implements an A LEFT JOIN B join_condition as follows:

  • Table B is set to depend on table A and all tables on which A depends.
  • Table A is set to depend on all tables (except B) that are used in the LEFT JOIN condition.
  • The LEFT JOIN condition is used to decide how to retrieve rows from table B. (In other words, any condition in the WHERE clause is not used.)
  • All standard join optimizations are performed, with the exception that a table is always read after all tables on which it depends. If there is a circular dependence, MySQL issues an error.
  • All standard WHERE optimizations are performed.
  • If there is a row in A that matches the WHERE clause, but there is no row in B that matches the ON condition, an extra B row is generated with all columns set to NULL.

Cryptico

How to COMPUTE a key
  • A public key can be obtained elsewhere, so no need to worry about encryption or signature verification.
  • A private key could be obtained elsewhere too, but such a feature is not available in my implementation.
  1. Put a passphrase into the My Passphrase field.
  2. Press the Compute button.
  3. Get the computed key from the My Key field.
How to ENCRYPT a message
  1. Put the public key of the receiver into the Their Public Key field.
  2. Put your decrypted message into the Input Message field.
  3. If you want to add your signature to the encrypted message, put your key into the My Key field, otherwise leave it blank.
  4. Press the Encrypt button.
  5. Get the encrypted message from the Output Message field.
How to DECRYPT a message
  • If the encrypted message carries a signature you want to match, put the public key of the sender into the Their Public Key field.
  • Put your encrypted message into the Input Message field.
  • Put your key into the My Key field.
  • Press the Decrypt button.
  • Get the decrypted message from the Output Message field.

Their Public Key

My Key or Passphrase

My Public Key (computed)

Input Message

Output Message

Their Public Key (computed)

Using cryptico.js, json2.js.

Please, do not use this page for encrypting sensitive data.

You are advised to look elsewhere for serious encryption tools.