Post 344241 by cpsdqs@icosahedron.website
(DIR) More posts by cpsdqs@icosahedron.website
(DIR) Post #344052 by MightyPork@dev.glitch.social
2018-10-03T10:26:16Z
3 likes, 4 repeats
welcome to PHP, where block scope does not exist and everything works "funny"also, celery is now fruit
(DIR) Post #344077 by cpsdqs@icosahedron.website
2018-10-03T10:28:08Z
0 likes, 0 repeats
@MightyPork what the hell
(DIR) Post #344105 by MightyPork@dev.glitch.social
2018-10-03T10:30:25Z
0 likes, 0 repeats
@cpsdqs the first loop makes $item a pointer to the iterated array element, then it leaks its scope pointing to the last element because of shit language design. Then the second loop assigns to it as it iterates over the veggies array, so at the end it's content is celery. It's, just, how can something suck so much
(DIR) Post #344172 by freundTech@mastodon.xyz
2018-10-03T10:38:33Z
0 likes, 0 repeats
@MightyPork @cpsdqs js isn't much better, but at least you can't combine it with pointers there.Try running:var i = 10;for (var i = 0; i < 5; i++) { console.log(i);}console.log(i);(And yes I know that the using let instead of var fixes that)
(DIR) Post #344207 by cpsdqs@icosahedron.website
2018-10-03T10:40:07Z
0 likes, 0 repeats
@freundTech @MightyPork I don’t think php even has the concept of shadowing
(DIR) Post #344208 by MightyPork@dev.glitch.social
2018-10-03T10:41:26Z
0 likes, 0 repeats
@cpsdqs @freundTech nah and you can set (nested!) array elements without first even creating the array and crap like that
(DIR) Post #344241 by cpsdqs@icosahedron.website
2018-10-03T10:46:35Z
0 likes, 0 repeats
@MightyPork @freundTech what
(DIR) Post #344290 by Caleon@metalhead.club
2018-10-03T11:00:31Z
0 likes, 0 repeats
@MightyPork Always unset() after by-ref looping. Or hope php gets fixed, maybe in v20...
(DIR) Post #344468 by MightyPork@dev.glitch.social
2018-10-03T11:24:53Z
0 likes, 0 repeats
@Caleon after figuring this out I searched our entire codebase and added unsets. it's so dumb
(DIR) Post #345631 by alchemist@mastodon.sdf.org
2018-10-03T13:45:05Z
0 likes, 0 repeats
@MightyPork What the fuck
(DIR) Post #348139 by wowaname@anime.website
2018-10-03T16:46:55.340031Z
1 likes, 0 repeats
@MightyPork this is terrible