This is a discussion on 'read data' within the alt.comp.lang.php forums, part of the PHP Programming Forums category; does php have the equivalent of a 'read... data' type statement? So, read $a .. .. .. data 5, 6, 7, -1 would ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
does php have the equivalent of a 'read... data' type statement? So,
read $a .. .. .. data 5, 6, 7, -1 would assign to $a the value '5' and then carry out instructions that lie between the 'read' and 'data' statements, before reading the next piece of data, that being '6'. I know the BASIC language has this sort of thing, but cant seem to find the equivalent for PHP.. thanks |
|
|||
|
"Jeremy Watts" <jwatts1970@hotmail.com> wrote in message
news:sYn%c.458$J07.356@newsfe5-gui.ntli.net... > does php have the equivalent of a 'read... data' type statement? So, > > read $a > . > . > . > data 5, 6, 7, -1 > > would assign to $a the value '5' and then carry out instructions that lie > between the 'read' and 'data' statements, before reading the next piece of > data, that being '6'. > > I know the BASIC language has this sort of thing, but cant seem to find the > equivalent for PHP.. > thanks You'd stick the data in an array and then loop through the array. Funny story. When I was working as the lab monitor at school, we had one student (halfway through her first BASIC course) who asked me "Why do we need files if we have the DATA statement for storing our data?" - Virgil |
|
|||
|
*** Jeremy Watts wrote/escribió (Tue, 07 Sep 2004 19:27:20 GMT):
> read $a > data 5, 6, 7, -1 > > would assign to $a the value '5' and then carry out instructions that lie > between the 'read' and 'data' statements, before reading the next piece of > data, that being '6'. > > I know the BASIC language has this sort of thing, but cant seem to find the > equivalent for PHP.. Sorry, I don't know anything about Basic. You want to loop though an array of numbers, don't you? It'd be something like this: $data=array(5, 6, 7, -1); foreach($data as $i){ // Here you do whatever you need with $i } -- -- Álvaro G. Vicario - Burgos, Spain -- Thank you for not e-mailing me your questions -- |