Difference between revisions of "EXECPHP()"

From Lianjapedia
Jump to: navigation, search
(Created page with "==Purpose== Function to run multiple lines of PHP code ==Syntax== EXECPHP(<expC>) ==See Also== COMPILE, EXEC(), EXECJAVASCRIPT(), EXECPYTHON(), [[EXECSCRIPT(...")
 
Line 19: Line 19:
 
select scripts
 
select scripts
 
append blank
 
append blank
replace script with 'for ($i = 1; $i <= 10; $i++) {' + CHR(13) + 'print "$i \n";';
+
replace script with 'for ($i = 1; $i <= 10; $i++) {' + CHR(13) + '// process commands;';
 
+ CHR(13) + '}' + CHR(13)
 
+ CHR(13) + '}' + CHR(13)
?execphp(script)
+
execphp(script)
  
 
// Text constant
 
// Text constant
?execphp('for ($i = 1; $i <= 10; $i++) {' + CHR(13) + 'print "$i \n";';
+
execphp('for ($i = 1; $i <= 10; $i++) {' + CHR(13) + '// process commands;';
 
+ CHR(13) + '}' + CHR(13))
 
+ CHR(13) + '}' + CHR(13))
  
 
// Memory variable
 
// Memory variable
m_script = 'for ($i = 1; $i <= 10; $i++) {' + CHR(13) + 'print "$i \n";';
+
m_script = 'for ($i = 1; $i <= 10; $i++) {' + CHR(13) + '// process commands;';
 
+ CHR(13) + '}' + CHR(13)
 
+ CHR(13) + '}' + CHR(13)
?execphp(m_script)
+
execphp(m_script)
 
</code>
 
</code>
  

Revision as of 07:56, 11 January 2013

Purpose

Function to run multiple lines of PHP code

Syntax

EXECPHP(<expC>)

See Also

COMPILE, EXEC(), EXECJAVASCRIPT(), EXECPYTHON(), EXECSCRIPT()

Description

The EXECPHP() function runs multiple lines of PHP code. The lines of code are contained in <expC>, which can be a text constant, a character variable, or a character or memo field. The EXECPHP() function can handle blocks of code. Individual lines of code must be separated by a CHR(13) carriage return character.

Example

create table if not exists scripts (script char(200))
if not used("scripts")
	use scripts
endif
select scripts
append blank
replace script with 'for ($i = 1; $i <= 10; $i++) {' + CHR(13) + '// process commands;';
+ CHR(13) + '}' + CHR(13)
execphp(script)
 
// Text constant
execphp('for ($i = 1; $i <= 10; $i++) {' + CHR(13) + '// process commands;';
+ CHR(13) + '}' + CHR(13))
 
// Memory variable
m_script = 'for ($i = 1; $i <= 10; $i++) {' + CHR(13) + '// process commands;';
+ CHR(13) + '}' + CHR(13)
execphp(m_script)