子程序 [英] Subroutines
问题描述
这是否曾经被考虑过,建议,讨论,辩论和/或
?通过子程序,我的意思是一大块代码,可以像
函数一样调用,但在全局空间中执行。是的,我知道一个包含
文件在全局空间中执行(如果从那里调用),但是当你有这样的代码块的数量时,它将是一个如果他们可以将
组合在一个文件中,那就更清洁了。
-
Alan Little
Phorm PHP表单处理器
http://www.phorm.com/
*** AlanLittleescribió/写道(星期四,2005年3月3日16:08:19 -0600):函数一样调用,但在全局空间中执行。是的,我知道一个include
文件在全局空间中执行(如果从那里调用),但是当你有许多这样的代码块时,如果它们可能会更加清晰br />合并在一个文件中。
你的意思是功能吗?
-
- +álvaroG。Vicario - 西班牙布尔戈斯
+ - http:/ /www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo,no amibuzón
- +将您的问题发送给小组,而不是发送到我的邮箱
-
Alan Little写道:
函数一样调用,但在全局空间中执行。是的,我知道一个include
文件在全局空间中执行(如果从那里调用),但是当你有许多这样的代码块时,如果它们可能会更加清晰br />合并在一个文件中。
只要有创意:
<?php
//routines.php
开关(
例程){
case''first'':
//一些代码
休息;
case''second'':
/ /一些不同的代码
休息;
默认:
//错误控制代码?
}
?>
<?php
// other.php
函数myFunc的(
Is this something that has ever been suggested, discussed, debated and/or
considered? By subroutine I mean a chunk of code that can be called like a
function but which executes in the global space. Yes, I know an include
file executes in the global space (if called from there), but when you have
a number of such chunks of code, it would be a lot cleaner if they could be
combined in one file.
--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
*** Alan Little escribió/wrote (Thu, 03 Mar 2005 16:08:19 -0600):Is this something that has ever been suggested, discussed, debated and/or
considered? By subroutine I mean a chunk of code that can be called like a
function but which executes in the global space. Yes, I know an include
file executes in the global space (if called from there), but when you have
a number of such chunks of code, it would be a lot cleaner if they could be
combined in one file.
Do you mean functions?
--
-+ álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--
Alan Little wrote:
Is this something that has ever been suggested, discussed, debated and/or
considered? By subroutine I mean a chunk of code that can be called like a
function but which executes in the global space. Yes, I know an include
file executes in the global space (if called from there), but when you have
a number of such chunks of code, it would be a lot cleaner if they could be
combined in one file.
Just be creative:
<?php
//routines.php
switch(
routine){
case ''first'':
// some code
break;
case ''second'':
// some different code
break;
default:
// error control code?
}
?>
<?php
// other.php
function myFunc(
这篇关于子程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!