<html>
<head>
<title>An array example</title>
</head>
<body bgcolor=#CCCCCC>
<h1>An array example</h1>
<form>
<input name = name>
</form>
<?

$programmer[Python] ="Guido";
$programmer[Perl]   ="Larry";
$programmer[PHP]    ="Rasmus";
$programmer[Tcl]    ="John";


$what = $_GET[name];

if ($what){
    if($programmer[$what]){
   print "$programmer[$what] wrote $what";
    }
    else{
   print "$what ??? No such language.";
   print "Known languages are:<ul>";
   $thekeys = array_keys($programmer);
   for ($l = 0; $l <count($thekeys); $l++){
       print "<li>$thekeys[$l]";
   }
   print "</ul>";
    }
}
else{
    print "You need to enter a name of a language.";
}
?>



-- PeterJones - 07 Nov 2006

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2006-11-07 - PeterJones
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback