[PHP] Function variables

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

  • BoomSmurf
  • Registratie: Maart 2003
  • Laatst online: 13-06 16:50
Kun je in PHP functies aan variabelen toekennen? Ik bedoel het volgende (wat ik hier doe is gewoon een voorbeeld, niet precies wat ik wil doen) .


code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function writeRowHTML($row) {
  // blaat
}

function writeRowXML($row) {
  // blaat
}

if ($writeMode = 'HTML') {
  $writeRow = writeRowHTML;
} elseif ($writeMode = 'XML') {
  $writeRow = writeRowXML;
}

...
...
...

while ( ... ) {
  $writeRow($row);
}


Of moet ik hiervoor classes gaan gebruiken? (ook nog niet gedaan onder PHP, ben een redelijke PHP noob ;))

Acties:
  • 0 Henk 'm!

  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 02:21

Janoz

Moderator Devschuur®

!litemod

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


Acties:
  • 0 Henk 'm!

  • BoomSmurf
  • Registratie: Maart 2003
  • Laatst online: 13-06 16:50
_/-\o_ En bedankt!

Ongelofelijk dat ik die pagina niet gekregen heb met m'n google en php searches 8)7

Acties:
  • 0 Henk 'm!

  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 02:21

Janoz

Moderator Devschuur®

!litemod

Soms werkt de inhoudsopgave veel makkelijker. Niet teveel blindstaren op de search allen ;).

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


Acties:
  • 0 Henk 'm!

  • Obliterator
  • Registratie: November 2000
  • Laatst online: 19-09 14:48
Met classes is het wel wat netter. Leuk als zelf-leer hobby project zou ik zeggen.