'read data'

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 ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-07-2004
Jeremy Watts
 
Posts: n/a
Default 'read data'

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


Reply With Quote
  #2 (permalink)  
Old 09-07-2004
Virgil Green
 
Posts: n/a
Default Re: 'read data'

"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


Reply With Quote
  #3 (permalink)  
Old 09-08-2004
Alvaro G Vicario
 
Posts: n/a
Default Re: 'read data'

*** 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
--
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:37 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0