Jump to content

Change Function name in loop


shogemuk

Recommended Posts

Hi guy,

Does any know how to add a variable value to the name of a function in a loop

 

e.g.

$i=1;
while($qryRowName = mysql_fetch_assoc($qryName)){
$i++;

function test$i(){
*****
}

 

Is this possible?

 

Please any help will be very much aprreciated

 

 

Thanks

 

 

 

}

Link to comment
Share on other sites

Thanks scootstah for the quick reply.

How would you use either of those functions to change the name of this function in a loop?

 

function createTemplatedSlide(PHPPowerPoint $objPHPPowerPoint)

{

// Create slide

$slide = $objPHPPowerPoint->createSlide();

 

// Add background image

    $slide->createDrawingShape()

          ->setName('Background')

          ->setDescription('Background')

          ->setPath('./images/realdolmen_bg.jpg')

          ->setWidth(950)

          ->setHeight(720)

          ->setOffsetX(0)

          ->setOffsetY(0);

 

    // Add logo

    $slide->createDrawingShape()

          ->setName('PHPPowerPoint logo')

          ->setDescription('PHPPowerPoint logo')

          ->setPath('./images/phppowerpoint_logo.gif')

          ->setHeight(40)

          ->setOffsetX(10)

          ->setOffsetY(720 - 10 - 40);

 

    // Return slide

    return $slide;

}

 

Thanks again

Link to comment
Share on other sites

Hi does anyone please know how to solve this.  Please any help in how to change this functions name in a loop.

function createTemplatedSlide(PHPPowerPoint $objPHPPowerPoint)

{

  // Create slide

  $slide = $objPHPPowerPoint->createSlide();

 

  // Add background image

    $slide->createDrawingShape()

          ->setName('Background')

          ->setDescription('Background')

          ->setPath('./images/realdolmen_bg.jpg')

          ->setWidth(950)

          ->setHeight(720)

          ->setOffsetX(0)

          ->setOffsetY(0);

 

    // Add logo

    $slide->createDrawingShape()

          ->setName('PHPPowerPoint logo')

          ->setDescription('PHPPowerPoint logo')

          ->setPath('./images/phppowerpoint_logo.gif')

          ->setHeight(40)

          ->setOffsetX(10)

          ->setOffsetY(720 - 10 - 40);

 

    // Return slide

    return $slide;

}

 

Thanks again

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.