PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hello, I am working on a project involving php reading external files and I am having trouble figuring out a way to get variables in the external file into an array. The external file variables are like
Your examples don't seem to correlate into a conversion logically.
you will need to create a parser for the external files. Depending on the flexibility you need, it may involve explode() and strpos() or regular expressions. It's possible you may use file() to break apart the file into seperate lines.. but that all depends on the language you create or have been dictated.
I can get the file into a string using get_file_contents, but I don't know what to do from there. Maybe I'll try one of those functions, but I already have been looking through the php manual a lot and haven't had much luck.
This isn't actually for school, just a hobby project. I'm creating a flash game and this is part of it.
you mean the "language" as in the external file? That is just a widely used format for the game I am attepting to make. there are only about 5-15 variables, depending on what the author of the file wants in it. SOme variables are like
is there a specification for this file format somewhere? Knowing how the files are laid out, we can better direct you to creating a parser.. or finding an existing one.