I need help with some PHP code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need help with some PHP code

Hey guys, I have a task to make a php script that takes txt file on INPUT and return another modified file on OUTPUT. It's a terminal script(command line). It's like syntax analysis in scanner of a compiler. I have to go through chars 1 by 1 and detect macros (regex) and replace them.... Question1: I used fgetc() but I need white spaces... how can I solve it? Question2: How to effectively use regex in php? (smth more than IF web) Question3: Where in PHP can I build structures? I need to store every macro(@macro_name) in a list or tree. Question4: How to manage command line arguments in php? I mean, I want to implement: $ script_name -controller ; where controller changes behavior of the script. If I type smth wrong or misty, I will explain it gladly. Thanks for all helpful answers in advance :)

14th Feb 2017, 4:17 PM
Roman Santa
Roman Santa - avatar
2 Answers
0
I recommend to use files
26th Feb 2017, 2:28 PM
Rafael
0
Q 1,2,3 solved I need help with Q4 now... any ideas??
28th Feb 2017, 8:37 AM
Roman Santa
Roman Santa - avatar