PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 16th, 2000, 12:52 PM
badboy badboy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 12 badboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Keep getting "fatal error" at the "if" statement line & nedd some help. Included the problem code bellow ! many thanks in advance !

add together the last two digits of the $year. If result is 10 or more, add the two digits together to reduce them to a single digit. Substract from 10. If answer is 5 use the digit 2.
If year 2000 and beyond* subtract from 9 (instead of 10).

<?php
$byear = 1992;
$first = substr($byear,2,1);* // Use substr to split the digits
echo("$first<br>");
$last = substr($byear,3,1);
echo("$last<br>");

echo("$first + $last");
echo"<br>";
$two = +($first + $last);* // add the 2 digits together
echo("$two");**
echo"<BR> how about it";

if ($two >= 10)* {*******// If $two is* equal to 10 or more, split again************
$first2 = substr($two,0,1);
echo("$first2<BR>");
$last2 = substr($two,1,1);
echo("$last2<BR>");
$third = +($first2 + $last2);**// Add together again
echo"<br>";
echo("$third");*********// Result is one digit
$fourth = - (10 - $third);**// Subtract from10
exit;
} else* {******//* if value of $two is less than 10
$fourth = - (10 - $two);** // Subtract from10
{***********************
}
if ($byear >= 2000) {*** // if year is greater or equal to 2000
$md = - ( $fourth - 1);**// Subtract 1 from $fourth
} else
$md = $fourth; {
}
if ($md == 5) {****//* If $fourth value equals 5, use 2
$md = 2;
else
$md = $fourth;*** // Else use first instance of value $fourth
}
}
?>

Reply With Quote
  #2  
Old May 16th, 2000, 01:06 PM
jonherron jonherron is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 24 jonherron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
if ($two >= 10)

perhaps it is thinking that $two is a string, have you tried converting it to an integer?

Reply With Quote
  #3  
Old May 17th, 2000, 08:51 PM
badboy badboy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 12 badboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
HI jonherron, I will try that. Thanks,
Peter

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > if statements & functions help

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap