Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    377
    Thanks
    8
    Thanked 1 Time in 1 Post

    How to set many variables to same value

    Hello,

    I had to use such commands in one of my scripts:

    PHP Code:
    $apple "";
    $orange "";
    $berry "";
    $peach "";
    $banana "";
    $kiwi "";
    $mango ""
    is there a better syntax to set them all to "" in one line? Or should I build an array and make a loop?

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    PHP Code:
    $apple $orange $berry $peach $banana $kiwi $mango ""
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.


  •  

    Posting Permissions

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