Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-03-2010, 08:25 PM   PM User | #1
harkly
Regular Coder

 
Join Date: Jun 2010
Location: Earth
Posts: 305
Thanks: 27
Thanked 2 Times in 2 Posts
harkly is an unknown quantity at this point
else if quick question

Is it ok to use an if/elseif without the last else?

I have some code that I only want to do something based on 2 things and then I don't want it to do anything but move on.

for example

PHP Code:
<?php

if ($r_status == 0){
  echo 
"this stuff"; }
else if (
$r_status == 1){
  
ehco "this other stuff"; }

?>
$r_status can = 2 & 3 a well but I don't want anything to print, just want it to move on

I have it up and working, just wondering if this is an appropriate way of doing it. Can't find anything online about not using the last else
harkly is offline   Reply With Quote
Old 12-03-2010, 08:34 PM   PM User | #2
Lamped
Super Moderator


 
Join Date: Feb 2009
Location: England
Posts: 539
Thanks: 8
Thanked 63 Times in 54 Posts
Lamped will become famous soon enough
Yes, that's fine.
__________________
lamped.co.uk :: Design, Development & Hosting
marcgray.co.uk :: Technical blog
Lamped is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:57 PM.


Advertisement
Log in to turn off these ads.