Комментарии:
News: man does not know about prag_match_all, creates unnecessary for_each
ОтветитьI love how Pascal is in the same category as brainfuck for him 😂
ОтветитьYou can do this is in regex? I didn't. I can't even imagine how you would do it in regex. Well, I also did it in C, so that might've had something to do with it.
ОтветитьAlways fun to see how people that don't know PHP write PHP 😂 Great video!
ОтветитьTreating `echo` like a function bothered me more than it should.
Ответитьthe bro just set up a whole web server instead of just using the interpreter 💀
ОтветитьLove this series. Don't love the profanity.
ОтветитьMaybe I should make my own videos. All you need to do is check what the number is before the letter 'r', 'g', 'b' for each line. You don't even need to parse the game ID as you can use a counter because the gameIDs are sequential. Also, I just subtracted bad games from the sum(1 to 100) = 5050. Because you only need 1 bad pull and the series of pulls is bad.
EDIT: I do commend you on getting the answer correct the first time though. I usually have to miss a few times and tinker my way to success.
To be honest, no one who actually enjoys PHP codes php this way. If they did, they'd not like it so much. See: PHP The Wrong Way for the correct methods.
ОтветитьOne liner: 'sudo apt-get install php-cli -y' done.
ОтветитьLove how at the beginning Haskell was put in the same category as Brainf**k.
ОтветитьThis was hard to watch with rudimentary skills of PHP
Ответитьah... I love PHP, the coding for forums...
ОтветитьI never learned grep, can i take your review to mean its still not worth learning?
Ответитьtbh it's not PHP's fault that you decided to do this without getting info on what errors are throwing
ОтветитьIt's interesting how stereotypes about php are still stuck in the heads of people. But the most interesting thing is that your code feels old. I get that feeling about c and c++ code a lot. It always feels like it was written about 20 years ago
Ответитьi am just pissed when FULL stack says he hates one particular language. he actually hates English as well :D
ОтветитьI haven't touched PHP in years, but this was clearly not the best code ever. :P
Regex is great by the way, I have solved so many problems with regex in the years, in many different situations and many different languages, it's really a worth to learn it.
However the parsing here does have to be done with regex, if you do this job with a bit of functional programming in Rust for example, it's quite trivial to split, map and collect everything into a data structure. Main level is the split at the semicolons, inside that you have the comas end eventually you simply split at space, all in a nice flow of code.
Not a single loop needs to be written.
Especially great if you make enum and struct fields for the color names and numbers.
You can read the entire file directly into an array: $lines = file("day2.txt");
ОтветитьThis guy do not know PHP
ОтветитьNot only could you run PHP CLI, you could just set the content-type to "text/plain". PHP is not the problem; you are.
Ответитьphp isn’t so bad. there’s way better ways to have accomplished this
ОтветитьI didn’t think part one was going to work because I didn’t see you account for the fact that you can have multiple entries for each color. However, it is kind of hard to follow the code on the iPad. And apparently it did work. 😬
ОтветитьI'm so used to PHP 8.2 by now that I automatically thought of using a match instead of a chain of if's. lol
ОтветитьYou can send a content type header to the browser and tell it that the PHP output is type text/plain. Then you won't have to use HTML line breaks
Ответитьit could be more easy with regex, but is ok doing a lot of explodes... but "$game_possible == True"? - now I am thirsty of blood :) .
ОтветитьDude run web-server to make code even worse with all those `echo("<br>")` 😂
ОтветитьRegex stands for rejular expression. 😋
Ответитьbro typing 2005 PHP and complaining it's bad 💀
ОтветитьWon't be subscribing
ОтветитьIF SERIES, TITLE IT AS SUCK. fuck me man
ОтветитьThere's a lot I don't understand but the few parts I did had me laughing. Awesome! But hasn't PHP improved with Version 8?
ОтветитьIs this guy dumb on purpose?
ОтветитьThe better experienced programmers can make shit into something useful or usable, just hard work and deeper knowledge
ОтветитьI'm confused, why is type casting really bad in PHP? What language is really good for type casting?
You also don't need to cast a string to an int when the string is a number.
"100" + 1 = 101
Use list instead of doing explode, explode, etc. Your code is horrible.
ОтветитьWhy does bro look like potato (joke, dont take it seriously)
ОтветитьAdd Assembly and VBA to the wheel
Ответитьi can do this in awk
ОтветитьI didn't catch which PHP version you were using. I know it wasn't 8.4, because that's in the RC stage right now.
Ответитьphp is fun, explode, split is better but explode is way more fun
Ответитьphp noob
ОтветитьAt the end of the day PHP gets the job done, quickly... that's the reason why we all use it
Ответитьas someone learning rust watching this, this is awful
Ответитьjust add a <pre> tag (no even need to close it) on top and outside of your script to be able to use \Ns instead of <br>s
ОтветитьPeople sometimes write bad PHP code and then blame the language for their bad code
ОтветитьPhp = Lambo.
Ответить