Lokomotive Posted January 28, 2005 Report Share Posted January 28, 2005 man saka: Warning: Missing argument 1 for zemnieks() in C:\xxxxx Stulbs jautājums, bet kā lai es nododu mainīgo funkcijai? <?php $a = "1"; function zemnieks($a){ echo 'zemnieks saprata, ka vilks apeeda '.$a.' govi'; } return zemnieks(); ?> Link to comment Share on other sites More sharing options...
Kavacky Posted January 28, 2005 Report Share Posted January 28, 2005 <?php $a = "1"; function zemnieks($a) { echo 'zemnieks saprata, ka vilks apeeda '.$a.' govi'; } [b]zemnieks($a);[/b] ?> Mainīgo funkcijai nodod kā parametru tajā iekavās ( () ). Link to comment Share on other sites More sharing options...
Venom Posted January 28, 2005 Report Share Posted January 28, 2005 resp. zemnieks(2); // 2 govis var funkcijās rekstīt vērtības pēc noklusējuma, piem. function mainu($a=0,$b=5) { echo 'mainu '.$a.' govi(s) pret '.$b.' zosi(īm)!'; } mainu(3); mainu(1,5); Link to comment Share on other sites More sharing options...
Recommended Posts