3 ms·
a "single for loop" and a "fibonacci method" are different enough. there are loads of people who take money for working in PHP, and they're closer to pc86's vi
by mgkimsal 10y ago
a "single for loop" and a "fibonacci method" are different enough.
there are loads of people who take money for working in PHP, and they're closer to pc86's view of things than yours. I wouldn't say "99%" but... there's a lot. A LOT. I've run (and attended) several local tech meetups in my area, and ... there's a huge amount of technical talent, but also a surprising number of people bumbling around with wordpress, drupal and other systems. They generally don't have a clue what't they're doing with respect to PHP code, but they make a living modifying themes by cut/paste stuff from forums.
- Shanea93 10y agoHere, fibonacci implemented in a single for loop (obviously, there's cruft in there to modify the array but there's no need for us to be facetious). Feel free to wrap function call around it if the procedural nature makes you feel icky. $iterations = 50; $numbers = [1,0]; for($i=0; $i<$iterations; $i++) { array_push($numbers, $numbers[0] + $numbers[1]); array_shift($numbers); echo $numbers[0]; } You seriously expect me to believe that 99% of PHP developers couldn't have written this?
- mgkimsal 10y agoI'm not sure why you posted code here - I don't think the possibility of this code being written was ever in doubt. Personally, I already said I don't think 99% is accurate, but... we'd have to define terms. "PHP developer" - is that different from someone who modifies (or creates) PHP code as part of their job to earn a living? Maybe they're just "PHP workers"? The very notion of "array_shift" and "array_push" is foreign to a non-trivial amount of PHP workers. The word fibonacci is foreign to a hell of a lot of people who make their living in code. I don't think you interact with beginners/amateurs enough to understand where pc86 was coming from. If you describe fibonacci in english, gave some working parameters, I would be willing to bet 15-20% of people who self-identify as "PHP developers" (and get paid a wage for it) would struggle and ultimately fail that test above. I still see code (not a lot, grant you) where people have not understood what passing a parameter to a function call means, and instead the first line of each function call is a string of "global $foo" stuff.