definire un array, mostrarne i valori
$array = array(
"foo" => "bar",
"bar" => "foo",
);
echo $array['foo'];
echo $array['bar'];
// multidimensionale
$array = array(
"mario" => "maria",
2 => 3,
"bar" => array(
"more" => array(
"bar" => "foo",
"foo" => $array
)
)
);
echo $array['mario']; // mostrare il valore
echo $array[2]; // mostrare il valore
echo $array['bar']['more']['bar'];
echo $array['bar']['more']['foo']['foo'];
ciclo su un array: for e foreach
// considera che in php puoi avere
// array associativo
$disney = array("pippo" => "goofy", "paperino" => "donald");
foreach($disney as $key => $value) {
echo "it=" . $key . ", en=" . $value;
}
// array indicizzato
$disney = array("goofy", "donald");
$arrlength = count($disney);
for($x = 0; $x < $arrlength; $x++) {
echo $cars[$x];
}
array
qui?
var art = ["Picasso", "Mondrian", "Wahrol"];
array
//studia la scrittura int[] per dichiarare un array di dati int, e similmente per gli altri tipi di dati.
int[] x = { 50, 61, 83, 69, 71, 50, 29, 31, 17, 39 };
int[] y = { 18, 37, 43, 60, 82, 73, 82, 60, 43, 37 };
void setup() {
size(640, 360);
strokeWeight(6);
noLoop(); // Run once and stop
}
void draw() {
// questo disegna la stella
for (int i = 0; i < x.length; i++) {
if(i < x.length-1){line(x[i], y[i], x[i+1], y[i+1]);}else{line(x[i], y[i],x[0],y[0]);}
}}
vedi sorgente per codice completo
Processing array2D p5js array2DPHP is a server-side scripting language designed for web development but also used .....
wikipediaJavaScript, often abbreviated as JS, is a high-level, interpreted programming language. .....
wikipediaProcessing is an open-source computer programming language and integrated development environment (IDE) built for the electronic arts, new media art, and visual design communities with the purpose of teaching non-programmers the fundamentals of computer programming in a visual context ....
wikipediaAccademia Statale Belle Arti Albertina Torino | ABTEC40 - Chiari- a.a.24.25| Thanks to http://templated.co.