Need Help On This Basic Php - Programming (2) - Nairaland
Nairaland Forum › Science/Technology › Programming › Need Help On This Basic Php (3939 Views)
| Re: Need Help On This Basic Php by Nobody: 7:58pm On Feb 21, 2016 |
Djade007:Did you not read the place I conceded defeat above? this basic PHP don big pass me (am even thinking of retirement as i don become olodo). ChinenyeN:You don fail already, did you not see the place above that the OP said he does not want to use stuffs like fopen, file_get_contents, file and their families. paranorman:It seems he actually want us to do a freaking miracle like this dude: Nmeri17: |
| Re: Need Help On This Basic Php by ChinenyeN(m): 8:11pm On Feb 21, 2016 |
dhtml18:My guy, I read his posts five times over just to make sure I understood well enough, and concluded that he may not have known the right words to use to describe his situation. From how I understand it now, he doesn't want to use functions that have the word "file" in them. I take it that he meant it literally (as in, if the function has the word "file", then he doesn't want to use it). So, I stuck with the f-type functions (they don't have the word "file" in them). Now, if he comes around and says that is not what he is looking for, then I will be at a loss. There's just no other way around this save for juju and there is no juju in computer programming. |
| Re: Need Help On This Basic Php by Nobody: 8:15pm On Feb 21, 2016 |
ChinenyeN:Hmn, I read the post like 20 times at least, and yet I still feel like monkey-banana, this OP has made a monkey-out-of-me! |
| Re: Need Help On This Basic Php by Nobody: 12:33am On Feb 22, 2016 |
I am still waiting o, not going to sleep o. |
| Re: Need Help On This Basic Php by asalimpo(m): 12:49am On Feb 22, 2016 |
See why basic communication skills are important. The other day a full grown papa wandered into this section and farted some of foulest english this room has seen in a long time. He stuck to his guns and other programmers stood by him too. Now, see miscommunication keeping some1 up all night, spawning multiple posts all to get at the gist of what the op was trying to say! (excess typing , excess time, excess brain cycles constitutes wasted resources). |
| Re: Need Help On This Basic Php by Nobody: 6:37am On Feb 22, 2016 |
And i am still waiting. . . . <?php |
| Re: Need Help On This Basic Php by paranorman(op): 8:52am On Feb 22, 2016 |
Nmeri17:this is twice as nice than rice! Thank goodness you understood o. As a rookie, I never see this kain syntaxes before o.. |
| Re: Need Help On This Basic Php by paranorman(op): 8:58am On Feb 22, 2016 |
ChinenyeN:boss, I not implying that you do not use the fopen, fgets, fputs, fwrite functions, what I mean is that you do not use functions with 'file' in its syntax; like readfile(), file_get_contents, file(), e.t.c. |
| Re: Need Help On This Basic Php by paranorman(op): 9:04am On Feb 22, 2016 |
ChinenyeN:you are correct...! So, you haven't replaced the string though.. |
| Re: Need Help On This Basic Php by paranorman(op): 9:08am On Feb 22, 2016 |
| Re: Need Help On This Basic Php by Nobody: 9:26am On Feb 22, 2016 |
paranorman:It is a miraculous syntax in case you failed to realize it paranorman:If that is the case, use fopen in the code i supplied earlier - i am not going to write any more codes on this thread anymore for sanity reasons. paranorman:We await your solution. . . . |
| Re: Need Help On This Basic Php by ChinenyeN(m): 2:41pm On Feb 22, 2016 |
paranorman:Replacement can easily occur in the while loop, just by adding an if condition.
|
| Re: Need Help On This Basic Php by Nobody: 2:53pm On Feb 22, 2016 |
ChinenyeN:Chisox! you guys no go kill human-being for this thread, i am still awating the miraculous solution mind you. . . . |
| Re: Need Help On This Basic Php by paranorman(op): 2:57pm On Feb 22, 2016 |
ChinenyeN:thanks for your time on this thread, you guys were really helpful. |
| Re: Need Help On This Basic Php by Nobody: 3:46pm On Feb 22, 2016 |
paranorman:You need to submit the trivial/basic code o, otherwise, i go para for you seriously o. |
| Re: Need Help On This Basic Php by ChinenyeN(m): 6:28pm On Feb 22, 2016 |
paranorman:You should be aware that the solution provided will replace all instances of "alex" at index 0. So if you only want to replace a certain "alex" or do different replacements at certain indexes, you will have to add to the if-statement or create a decision tree of some kind. |
| Re: Need Help On This Basic Php by ChinenyeN(m): 6:30pm On Feb 22, 2016 |
dhtml18:Haha. You fit wait until universe come collapse? |
| Re: Need Help On This Basic Php by Nobody: 7:54pm On Feb 22, 2016 |
ChinenyeN:Na until i e-kill person with an e-knife on this thread before you guys know that I am not joking! |
| Re: Need Help On This Basic Php by paranorman(op): 2:06am On Feb 23, 2016 |
dhtml18:bros, which kain solution you dey wait for na? rookie like me wey no understand anything?! That was why I laid the question all bear here, though it was kinda ambiguous at first; you guys pulled it through. Here is my own nonsense version of the code jare, I bet you and ChinenyeN will understand me after checking it out - it's kinda unnecessarily long jare, that was why I was looking for a 'shortcut': $file = "names.txt"; |
| Re: Need Help On This Basic Php by Nobody: 1:17pm On Feb 23, 2016 |
Shouts: Lord, God, Almighty! *Does sign-of-the-cross* #and# *Dies* |
| Re: Need Help On This Basic Php by ChinenyeN(m): 5:50pm On Feb 23, 2016*. Modified: 7:06pm On Feb 23, 2016 |
Paranorman, I would say that you did good, being a rookie. I always try to remind people that programming is about critical thinking, algorithms and problem-solving. I also always try to encourage newer programmers to focus more on their algorithm than the language features itself, because you will always learn the language features as you go along. Looking at the code, I see you have a clear algorithm there. You know the necessary steps needed to solve your problem, and that is excellent. Now, as you learn more about PHP and its features, you will begin to see more appropriate functions or learn to write more appropriate methods to help you implement your algorithms in the future. Don't hurt your development as a programmer by thinking of things as "long cuts" or "short cuts". In reality, there are no "short cuts" in programming. Rather, its all about how appropriate your algorithm is and also how you implement it. |
| Re: Need Help On This Basic Php by paranorman(op): 6:18pm On Feb 23, 2016 |
ChinenyeN:thanks bro. dhtml self.. Hehehehe |
| Re: Need Help On This Basic Php by Nobody: 9:37pm On Feb 23, 2016 |
paranorman:*That your code has killed me on this thread* I am typing this from e-heaven! |
For Young And Basic Web Development HOP IN • Pls After Learning D Basic Php Wat Next? • Keywords / Reserved word In Q-BASIC • 2 • 3 • 4
TimeCoin - Developers wanted • I Need Help With A Php Program • MATLAB: The Language Of Technical Computing
in fact, you all should collectively get a mention whenever "Olodo" is typed on nairaland
that said, we get straight to business. OP, here is the code variant you have sought all your life!
, "r+"