Array_fill
Moderator: General Moderators
Array_fill
Does anybody know how the array_fill() algorithm works, on my computer it runs faster than array pad as well as an iterative approach. I was wondering if anybody knew how it worked
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Re: Array_fill
You best bet is to locate it's C source in the PHP CVS repository. I haven't looked at it so I couldn't say.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Re: Array_fill
http://cvs.php.net/viewvc.cgi/php-src/e ... iew=markup
It's not surprising that array_fill is much faster than the iterative approach or array_pad. array_fill uses PHP's internal C functions for manipulating arrays, bypassing the need to execute quite a few opcodes.
It's not surprising that array_fill is much faster than the iterative approach or array_pad. array_fill uses PHP's internal C functions for manipulating arrays, bypassing the need to execute quite a few opcodes.