hi, in my php program i need to do the following repeatly:
$newObject = new COM("comObject") or die("comObject could not be started");
is there a way for me to create a macro so that i only need to do the following:
$newObject = $macroComObject;
thankx a lot.
from alan.
php macro?
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
you could make a function that performs it..
Code: Select all
<?php
function newObject($name)
{
return new COM($name) or die("{$name} could not be started");
}
$newObject = newObject("comObject");
?>
Last edited by feyd on Fri Jun 25, 2004 2:08 pm, edited 1 time in total.
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
Code: Select all
<?php
function macroComObject(){
return new COM("comObject") or die("comObject could not be started");
}
$newObject = macroComObject();
?>-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
-
alanchinese
- Forum Newbie
- Posts: 11
- Joined: Fri Jun 11, 2004 4:53 pm