Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:lib/weblib.php: Difference between revisions

From MoodleDocs
No edit summary
m (Text replacement - "</code>" to "</syntaxhighlight>")
Line 11: Line 11:
             $ssl = false;
             $ssl = false;
         }
         }
</code>
</syntaxhighlight>


should never be used. It is equivalent to
should never be used. It is equivalent to
<code:php>
<code:php>
         $ssl = is_https();
         $ssl = is_https();
</code>
</syntaxhighlight>


However, in this case, the $ssl variable is used in exactly one place, so the code probably should not be using a local variable at all.--[[User:Tim Hunt|Tim Hunt]] ([[User talk:Tim Hunt|talk]]) 13:00, 6 October 2015 (AWST)
However, in this case, the $ssl variable is used in exactly one place, so the code probably should not be using a local variable at all.--[[User:Tim Hunt|Tim Hunt]] ([[User talk:Tim Hunt|talk]]) 13:00, 6 October 2015 (AWST)

Revision as of 20:23, 14 July 2021

is_https

I switch the is_https example to a better bit of sample code.

Code like

<code:php>

       if (is_https()) {
           $ssl = true;
       } else {
           $ssl = false;
       }

</syntaxhighlight>

should never be used. It is equivalent to <code:php>

       $ssl = is_https();

</syntaxhighlight>

However, in this case, the $ssl variable is used in exactly one place, so the code probably should not be using a local variable at all.--Tim Hunt (talk) 13:00, 6 October 2015 (AWST)