A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: PHP var construction (simple problem)

Threaded View

  1. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    You can just use an array:
    PHP Code:
    $images = array();

    for(
    $i=0;$i<$totalimages;$i++)
    {
        
    $images[$i] = $uploadfile;

    That's just some rough pseudo-code, but it just shows you how to use an array.

    BUT, if you really wanted to work with dynamically named variables, you could do this:
    PHP Code:
    for($i=0;$i<$totalimages;$i+)
    {
        
    $image 'Img'.$i;
        $
    $image $uploadfile;

    Notice the $$? It means use the value of $image as the variable name. So in this instance, you'd have access to variable names such as $Img0, $Img1, etc. But really, don't do that. Just use an array.
    Last edited by MyFriendIsATaco; 07-17-2009 at 03:39 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center