私はphp関数を定義しました:
function my_function($text = '', $relative = false, $icon = true) {
//do something
}
デフォルト値で期待どおりに機能します。しかし、1つの変数の値を変更したい場合、それは機能しません。
my_function($icon = false); // this doesn't change anything
変更を有効にするには、すべての変数を使用して呼び出す必要があります。
my_function($text = '', $relative = false, $icon = false); // this changes the output
私はphp5.4.1とWordpressで作業しています。私は何を間違えますか?ありがとう。