Jump to content

Archived

This topic is now archived and is closed to further replies.

extrovertive

filling an array with all 0's

Recommended Posts

without the use of a for-loop.

Is there a built-in function for this? Like I know for strings, I can use str_repeat...but what about arrays?

Share this post


Link to post
Share on other sites
[code]<?php
$array = array_fill(0,9,'0');
?>[/code]

Will make ten keys with the value 0.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.