发送数组在PHP中发挥作用 [英] send array to function in php

查看:103
本文介绍了发送数组在PHP中发挥作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是code:

 函数DoSomething的()
{
  ...做一些与阵列...像印刷价值!
}$芳=阵列(1,2,3);
DoSomething的($ AR);

这件code的细...

我尝试做的是直接传递数组功能
我有尝试这个,非工作...帮助!

  DoSomething的([12,32,56]);
DoSomething的({12,45,87});
DoSomething的([98,74,52]);


解决方案

  DoSomething的(阵列(12,32,56));

Here is the code :

function dosomething ()
{
  ... do something with the array... like print value !
}

$ar = array(1,2,3);
dosomething ($ar);

That piece of code work fine...

What i try to do is to pass the array DIRECTLY to the function i have try this, non work... HELP !

dosomething ([12,32,56]);
dosomething ({12,45,87});
dosomething ("[98,74,52]");

解决方案

dosomething( array(12,32,56) );

这篇关于发送数组在PHP中发挥作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆