|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
reading a text file with variables into php variables
I have a text file that has a series of variables in it, in the form
var1 = val1 var2 = val2 ... I am new to php and would like to read this file and parse it. The result being having the variables to use as global php variables. The text file will have the parameters to control how the php displays information on the screen. |
|
#2
|
||||
|
||||
|
read it using file() and then parse it with a regex to get the var and value out, then use extract() to put them all into php (or eval) as valid variables
|
|
#3
|
|||
|
|||
|
Quote:
could you point me to an example? I am not sure how to use regex() or extract() thanks |
|
#4
|
||||
|
||||
|
did you read the manual on those 2 functions? preg_match extract
I can help you with the regex but show me what you got, extract should be easy enough to figure out. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > reading a text file with variables into php variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|