arrays - How to get array_walk working with PHP built in functions? -


I just use array_walk () to ceil ()

Code:

  $ numbs = array (3, 5.5, -10.5) To do all the elements within an array, but it does not work. ; Array_wock ($ numbs, "ceil"); Print_r ($ numb);  

should be output: 3,6, -10

Error message:

Warning: CIIL () expects that 1 parameter,

is output on 2 row 2: 3,5.5, -10.5 (using CIL)

I also tried with round ()

I had the same problem with another PHP function. You can make "your own custom work" in that situation, it is very easy to solve:

  function myCeil (& $ list) {$ list = ceil ($ list); } $ Numbs = array (3, 5.5, -10.5); Array_walk ($ numbs, "myCeil"); Print_r ($ numb);  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -