You are here: Re: Getting variables from another file « PHP Programming Language « IT news, forums, messages
Re: Getting variables from another file

Posted by Ψrjan Langbakk on 09/27/98 11:56

Den 14.08.2006 22:41, skriblet mootmail-googlegroups@yahoo.com fΓΈlgende:
> Ørjan Langbakk wrote:
>> And, as I am also new to the array-functions, how would I go around
>> creating that file, and pulling the different values from it?
>>
>> I'm thinking I could use something like:
>>
>> <?php
>> $prices = array (
>> product1 => 1200,
>> product2 => 2400,
>> product3 => 3450,
>> )
>> ?>
>>
>
> To do this, put that $prices array in a file all by itself.
> Then, from the page that needs to use this data, use require_once [1]
> to include the file.
> To access the data for a specific product, then, you would say, for
> example, $prices['product1'].

Wouldn't that mean that it would have to read through the entire
prices.php file, to get the one value I need? I mean, using require_once.

Wouldn't it be possible to just use the $_GET variable or something,
using the prices.php as the file from where to get the data?

Or is the require_once the best way of doing this?

--
mvh
Ørjan Langbakk
http://www.bergenpchjelp.no
http://www.cubic-design.net

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация