Which version of foreach is the best/newest
#1

Hello there, hope you all doing great,
so I stumble across different scripts where I see people using a version of foreach where they use
PHP код:
foreach(Playeri
the way I use it is
PHP код:
foreach(new Player
so which one is the newest version if they are the same at all, and what's the deal with YSI\y_iterate?
Which one do you recommend?
Reply
#2

The second syntax is the newer version.
Reply
#3

2nd all the way.
Reply
#4

Quote:
Originally Posted by Astralis
Посмотреть сообщение
2nd all the way.
Well the thing is, I recompiled my a script of mine accidentally without including foreach.inc or y_iterate.inc, the compiler gave no error, is it natively supported or what
Reply
#5

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
Well the thing is, I recompiled my a script of mine accidentally without including foreach.inc or y_iterate.inc, the compiler gave no error, is it natively supported or what
Do you include other file from YSI? If yes, it's normal.
Reply
#6

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Do you include other file from YSI? If yes, it's normal.
I guess that must be it, I have y_timers.inc and y_hooks.inc included
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
If you see code doing this, it is a good way to tell that the code has not been touched in literally 10 years and should probably just be ignored. That has not been the correct way to use foreach in a VERY VERY VERY long time!
This is ironic, I was literally just reading this http://forum.sa-mp.com/showpost.php?...&postcount=320

so, including anything from YSI allow using foreach without having to include y_iterate? Like in my case?
Reply
#8

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
This is ironic, I was literally just reading this http://forum.sa-mp.com/showpost.php?...&postcount=320

so, including anything from YSI allow using foreach without having to include y_iterate? Like in my case?
Yes. For Y_Hooks, you need to include it in every file you use it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)