Demo entry 6780729

petlje

   

Submitted by anonymous on Dec 28, 2018 at 13:46
Language: PHP. Code size: 713 Bytes.

<?php 

	for ($i=0; $i < 4; $i++) { 
		echo "Ja sam for petlja i trenutno sam u {$i} koraku";
		echo "<br>";
	}


	$nekiUslov = false;

	while ($nekiUslov) {
		echo "Visa sila je zadovoljena<br>";
	}

	do {
		echo "Izvrsicu se pa makar samo jedanput!<br>";
	} while(false);


	$niz = [1, 2, 3, 's', 'Hello', 'jos jedan'];
	foreach ($niz as $element) {
		echo "Prolazim kroz niz i gledam element {$element}<br>";
	}

	$niz = [
		
		'ime' => 'Misa',
		'prezime' => 'Kovic',
		'datum_rodjenja' => '10.1.1995.',
		'profesija' => 'Backend developer'
	];

	foreach ($niz as $kljuc => $vrednost) {
		echo "Prolazim kroz niz i gledam {$kljuc} koji ima vrednost {$vrednost}<br>";
	}

?>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).