如何获取PHP函数值?
例如,当使用函数“get_photo_id”时,我在里面使用数字 6。
示例:
<?php get_photo_id("6"); ?>
我希望函数 get_photo_id 获取内部的值(在本例中为 6)。能够找到里面的数字并为其分配一个变量。
像这样的事情:
function get_photo_id() {
<!--something to find the value used and assign it as $valueused -->
get_cat_id('$valueused')
echo 'cat_id'
}
我希望你明白我的意思...我是 php 的新手!
When using a funciton for example, "get_photo_id" and I use the number 6 inside.
EXAMPLE:
<?php get_photo_id("6"); ?>
i want the function get_photo_id to get the value inside (which is 6 in this case). To be able to find the number inside and assign a variable to it.
Something like this:
function get_photo_id() {
<!--something to find the value used and assign it as $valueused -->
get_cat_id('$valueused')
echo 'cat_id'
}
I hope you get what i mean... im kind of new in php!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
函数参数按如下方式传递:
结果为
Function arguments are passed as follows:
results in
你指的是函数参数吗?
当您调用
foo("6")
时,它将回显6
。但是,如果您想使用数字,最好使用数字调用foo(6)
,而不是包含数字的字符串。Do you mean function parameters?
When you call
foo("6")
it will echo6
. However, if you want to work with numbers, its better to callfoo(6)
with a number, instead of a string containing a number.我不清楚你的问题,但这可能是我理解的答案
I am not clear about your question, but this might be the answer from what i understand