Sliipeetais Posted August 26, 2004 Report Posted August 26, 2004 Vai ir iespējams apstaigāt visus funkcijai nodotos argumentus, nezinot cik daudz to ir? function diivainis() { //mistisks kods, kas echo visus funkcijai nodotos mainiigos } diivainis("lalalaa", "kakis", "suns", "koks"); // rezultaataa echo lalalaa kakis suns koks diivainis("kakis2", "suns2", "koks2"); // rezultaataa echo kakis2 suns2 koks2
bubu Posted August 26, 2004 Report Posted August 26, 2004 Nezinu vai var, bet es laikam rīkotos šādi: <?php function diivainis($params) { foreach($params as $item) { echo $item, ' '; } } diivainis(array('lalalaa', 'kakis', 'suns', 'koks')); diivainis(array('akis2', 'suns2', 'koks2')); ?>
spynode Posted August 26, 2004 Report Posted August 26, 2004 http://lv.php.net/manual/en/function.func-get-args.php
Sliipeetais Posted August 26, 2004 Author Report Posted August 26, 2004 Paldies gan bubu, gan spynode. Abi varianti man noderēja.
Recommended Posts