| | #1 |
| Warrior Member Join Date: 2013
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
|
Hi, I'm new in PHP thus need small help with his problem: - this is my current code: Code: <?php
= 'Text string 0 - ultimate info';
= 'Text string 1';
= 'Text string 2';
= 'Text string 3';
= 'Text string 4';
= 'Text string 5';
if ([100]) { print ; }
else if ([101]) { print ; }
else { print ; }
?> Code: <?php
= 'Text string 0 - ultimate info';
= 'Text string 1';
= 'Text string 2';
= 'Text string 3';
= 'Text string 4';
= 'Text string 5';
...
if ([100]) { print ; }
if ([101]) { print ; }
if ([102]) { print ; }
if ([103]) { print ; }
if ([104]) { print ; }
...
else { print ; }
?> |
|
Keep your dreams alive.
| |
| |
| | #2 |
| Designer & Front End Dev Join Date: 2012 Location: United Kingdom
Posts: 439
Thanks: 136
Thanked 134 Times in 87 Posts
|
You'd just use the "elseif" or "else if" statements over and over |
| I chose entrepreneurship over further education despite being laughed at by my friends and family.. I recently hit the "RESTART" button on my life, read my personal blog to find out how I did it :) | |
| |
| | #3 |
| Warrior Member Join Date: 2013
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
| |
|
Keep your dreams alive.
| |
| |
| | #4 |
| Software Engineer War Room Member Join Date: 2008 Location: Asheville, NC USA
Posts: 693
Thanks: 37
Thanked 112 Times in 100 Posts
|
You can try using the "switch" statement instead. PHP Code: |
| I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs | |
| |
| The Following User Says Thank You to wayfarer For This Useful Post: |
| | #5 |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 236
Thanked 1,377 Times in 676 Posts
|
^ Yep. Switch/case is usually best if you have a lot of conditions. It's hard to tell exactly what you're trying to do with your code though, because the forum strips out a lot of PHP code when you put it inside "CODE" tags. Since you don't have much code... if you post your code without using any of the forum "tags", we'll be able to help you better. Or use something like Pastebin.com, and link to it. |
| | |
| |
|
| Bookmarks |
| Tags |
| handle, multiple, php, statements |
| |