HomeImageDanskApachePHPCV

Basic

<?php
?>


<?php
echo 'He he he';
?>


<?php
echo '<div><h1>He he he</h1></div>';
?>


Variable
<?php
$variable = 'He he he';
echo $variable;
?>


<?php
$variable = 'He he he';
$variable2 = ' Ho ho ho';
echo $variable.$variable2;
?>


<?php
$variable = 'He he he';
$variable2 = 'Ho ho ho';
echo $variable.' '.$variable2;
?>




<?php
$top = '<html><head></head><body>';
$bund = '</body></html>';
echo $top.'<div><h1>He he he</h1></div>'.$bund;
?>


If, else og elseif
<?php
$midt = '<div><h1>He he he</h1></div>';

$top = '<html><head></head><body>';
$bund = '</body></html>';

if ($midt) {
    echo $top.$midt.$bund;
}
?>


<?php
$midt = '';

$top = '<html><head></head><body>';
$bund = '</body></html>';

if ($midt) {
    echo $top.$midt.$bund;
}
?>


<?php
$midt = '';

$top = '<html><head></head><body>';
$bund = '</body></html>';

if ($midt) {
    echo $top.$midt.$bund;
}
else {
    echo $top.'<div><h1>Ho ho ho</h1></div>'.$bund;
}
?>


<?php
$midt = '';
$midt2 = '<div><h1>Der mangles noget mere for at det bliver smart.</h1></div>';

$top = '<html><head></head><body>';
$bund = '</body></html>';

if ($midt) {
    echo $top.$midt.$bund;
}
elseif (midt2) {
    echo $top.$midt2.$bund;
else {
    echo $top.'<div><h1>Ho ho ho</h1></div>'.$bund;
}
?>


Post form
<?php
if ($_POST['submit']) {
    $midt = '<div><h1>'.$_POST['test'].'</h1></div>';
}

$top = '<html><head></head><body>';
$form = '<form method="post"><input type="text" name="text" /> <input type="submit" name="submit" value="Knap" /></form>';
$bund = '</body></html>';

echo $top.$midt.$form.$bund;
?>




Post form forsat
<?php
$title = 'Test';

if ($_POST['submit']) {
    $title .= " - ".$_POST['test'];
    $midt = '<div><h1>'.$_POST['test'].'</h1></div>';
}

$top = '<html><head><title>'.$title.'</title></head><body>';
$form = '<form method="post"><input type="text" name="text" /> <input type="submit" name="submit" value="Knap" /></form>';
$bund = '</body></html>';

echo $top.$midt.$form.$bund;
?>


Arrays i vaiabler.
<?php
$variable = array('He he he', 'ho ho ho');
echo $variable[0];
echo $variable[1];
?>


<?php
$variable[0] = 'He he he';
$variable[1] = 'ho ho ho';
echo $variable[0];
echo $variable[1];
?>


<?php
$variable = array(0 => 'He he he', 1 => 'ho ho ho');
echo $variable[0];
echo $variable[1];
?>


<?php
$variable['he'] = 'He he he';
$variable['ho'] = 'ho ho ho';
echo $variable['he'];
echo $variable['ho'];
?>


<?php
$variable = array('he' => 'He he he', 'ho' => 'ho ho ho');
echo $variable['he'];
echo $variable['ho'];
?>


<?php
$variable['text'][1] = 'He he he';
$variable['text'][2] = 'ho ho ho';
echo $variable['text'][1];
echo $variable['text'][2];
?>


<?php
$variable['text'] = array('He he he', 'ho ho ho');
echo $variable['text'][1];
echo $variable['text'][2];
?>


<?php
$variable = array('text' => array('He he he', 'ho ho ho'));
echo $variable['text'][1];
echo $variable['text'][2];
?>


<?php
$array = 'text';
$variable = array($array => array('He he he', 'ho ho ho'));
echo $variable[$array][1];
echo $variable[$array][2];
?>


<?php
$title = 'Test';

if ($_POST['submit']) {
    $title .= " - ".$_POST['text'][1];
    $midt = '<div><h1>'.$_POST['text'][1].'</h1></div>';
}

$top = '<html><head><title>'.$title.'</title></head><body>';
$form = '<form method="post"><input type="text" name="text[1]" /> <input type="submit" name="submit" value="Knap" /></form>';
$bund = '</body></html>';

echo $top.$midt.$form.$bund;
?>


While
<?php
$title = 'Test';
if ($_POST['submit']) {
    $title .= " - Submit";
}
$top = '<html><head><title>'.$title.'</title></head><body>';

$i = 0;
while ($i < 10) {
    if ($_POST['text'][$i]) {
        $midt .= '<div><h1>'.$_POST['text'][$i].'</h1></div>';
    }
    $form .= '<form method="post"><input type="text" name="text['.$i.']" /> <input type="submit" name="submit" value="Knap" /></form>';
    $i++;
}

$bund = '</body></html>';

echo $top.$midt.$form.$bund;
?>


<?php
$title = 'Test';
if ($_POST['submit']) {
    $title .= " - Submit";
}
$top = '<html><head><title>'.$title.'</title></head><body>';

$i = 0;
while ($i < 10) {
    if ($_POST['text'][$i]) {
        $midt .= '<div><h1>'.$_POST['text'][$i].'</h1></div>';
    }
    $form .= '<form method="post"><input type="text" name="text['.$i.']" /> <input type="submit" name="submit" value="Knap" /></form>';
    $i++;
}

$bund = '</body></html>';

echo $top.$midt.$form.$bund;
?>


Efter at DGI har godkendte eSport er der kommet rigtig gang i udvirkling og støtten til eSport. OldDevils er en af de nye sider som ønsker at samlet Counter Strike clan og spil community med nyheder, links, guides, forum osv.
"It does not do to leave a live dragon out of your calculations, if you live near him" ~ J.R.R. Tolkien