CodeIgniter URI Segment

URI of CodeIgniter is class_name/method_name/param.

Controller

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Greet extends CI_controlle r {

    public function test($a = null)
    {
        $b = date('H:i:s');
        if (null != $a)
        {
            $b .= '(現在時刻)' . $a;
        }
        echo $b . '(現在時刻)';
        return;
    }
}

If you access http://test.local/greet/test/hello, execute $b .= '(現在時刻)' . $a; and display 12:40:33(現在時刻):hello.

If you access http://test.local/greet/test, no exists param so get $a = null. execute echo $b . '(現在時刻)'; then display 12:40:33(現在時刻).