RE: [PHP] question from a php newbie
| From: | Maxim Maletsky | Date: | Sat, 18 Aug 2001 04:20:29 +0000 |
| Subject: | RE: [PHP] question from a php newbie | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63269@lists.php.net to get a copy of this message | ||
You know, what you can do (strongly not recommended, but still) is to insert
that whole thing into a database and then pull this string out and pass it
through eval().
ie: eval($record);
another way would be to take all that, addslashes($it) and then write into a
file with stripslashes($it).
But, you are going to need that statement to be a string, not code.
Otherwise you can "read yourself", fread() your own file to take your code
as a string.
After all, those are kinda silly methods. I am sure you can find a better
solution for your needs. Storing codes is a very powerful but not always
necessary procedure.
Cheers,
Maxim Maletsky
www.PHPbeginner.com
-----Original Message-----
From: 602e23 [mailto:602e23@email.com]
Sent: Saturday, August 18, 2001 12:26 PM
To: php-general@lists.php.net
Subject: [PHP] question from a php newbie
I'm so new to this, in fact, that I may not be able to
even frame my question correctly. Please bear with me.
Suppose that I had a list in a data base of, say, countries
and that I built an array as
$states = array (
array("abbr"=>"MA",
"name"=>"Massachusetts"),
array("abbr"=>"NY", "name"=>"New
York"),
array("abbr"=>"CA",
"name"=>"California"),
[. . .]
)
is there a way to dump this array in a form which would allow
it to be written to an 'include' file. I tried both var_dump
and print_r but neither method seems to have worked correctly.
The actual array which I have in mind is much more complicated
structurally than the states array shown above, but it is
unlikely to change more than once a day so it seems wastefull
to probe the database each time a copy is needed.
av0-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net