header("Location: http://www.example.com/"); Filter
2004-10-07
Redirect
Php
2004-10-06
Hash
Javascript
a['ett'] = 'Nummer ett';
a['två'] = 'Nummer två';
for (var key in a) {
document.write(key + ' = ' + a[key] + '<br>');
} 2004-10-05
Buffra webbsidan
Php
ob_start()
Enable output buffering. Output buffering supports multiple levels -- i.e., you can call ob_start() several times.
ob_end_flush()
Send the output buffer, and disable output buffering.
ob_end_clean()
Clean the output buffer without sending it, and disable output buffering.
ob_get_contents()
Return the current output buffer as a string. This allows you to process whatever output the script emitted, if you need to.
In addition, you can enable the php.ini directive output_buffering. If you do,
every PHP script will behave as if it begins with a call to ob_start().
2004-10-05
For in loop
Javascript
// loopen ignorerar element som inte finns (om det skulle finnas några sådana, dvs undefined)
nameArr = new Array("Rolf", "Sixten", , "Roland");
for (i in nameArr) {
document.write(i + " = " + nameArr[i] + "<br>");
} 2004-10-02
Variabla funktionsnamn
Php
<?php
function say_hi() {
print("Hi!<br>");
}
function say_greeting() {
print("How are you today?<br>");
}
function say_bye() {
print("Have a nice day.<br>");
}
$my_func = 'say_hi';
// NOTE: $my_func is a variable and not a function!
// So this is the say_hi() function executing,
// as $my_func contains the string 'say_hi'...
$my_func();
$my_func = 'say_greeting';
// $my_func now contains the string 'say_greeting',
// so the say_greeting() function will execute...
$my_func();
$my_func = 'say_bye';
// som ovan...
$my_func();
?> 