Jump to content

Texan78

Members
  • Posts

    272
  • Joined

  • Last visited

Everything posted by Texan78

  1. I completely agree. If tables are used properly which in this case to display data then they are completely fine to use. Which is why I debated on using tables instead but, wasn't sure how to roll over to a new row after X amount of columns. I have done something similar before with an array which I am still trying to master which would help me with what I am trying to do now. Only issue is it doesn't restrict to just one entry. It will show all of that entry if it exists more than once in the data. Here is the example. http://www.mesquiteweather.net/inc-weather_radio_alert.php $alertValue = array('Tornado Warning', 'Severe Thunderstorm Warning', 'Tornado Watch', 'Severe Thunderstorm Watch', 'Flash Flood Warning', 'Flash Flood Watch', 'Flood Warning', 'Flood Watch', 'Flood Advisory', 'Winter Storm Warning', 'Winter Storm Watch', 'Winter Weather Advisory', 'Special Weather Statement'); $events = array_intersect($alertValue, $event); $message = array_shift($events); // Set the alert colors for the banner background include ('inc-NWR-alert-colors.php'); // Lets assign some styles for the banner $bannerStyle = '"color: #333; width:100%; border-top-style:solid; border-bottom-style:solid; border-color:#FFF; border-width:1px; font-size:11px; font-weight:normal; font-family: Arial,Helvetica,sans-serif; text-align: center; background-color:' .$alertColor. '; margin-bottom:5px; padding: .2em 0em .2em 0em"'; // Lets assembly the banner to display $radiowarning = '<div style='.$bannerStyle.'> <strong>WEATHER BROADCAST ALERT - '.$message.'</strong>... Listen now to our LIVE NOAA Weather Radio Stream <a href="'.$feed.'" onclick="return popup(this, \'noaa\')" title="Live NOAA Radio For Dallas County"><span style="color:FFF">[Click here to listen]</span></a> </div>'; foreach( $alertValue as $alert ) { if (in_array($alert, $event)) { echo $radiowarning; } }
  2. Hello, I have done this with SimpleXML variables many times. I seem to be struggling with something really simple as I am venturing out with some JSON. Basically there is a variable $nowcast. Sometimes that node may be empty. So I want to display an alternative message if it is empty like it is now. Unfortunately I am having some struggles and can't get the message to display when the node is empty. What am I missing? -Thanks // Lets get parse the data and create the variables $json_string = file_get_contents("http://api.wunderground.com/api/REMOVED_KEY/geolookup/conditions/q/TX/Mesquite.json"); $parsed_json = json_decode($json_string); $Updated = $parsed_json->{'current_observation'}->{'observation_time'}; $location = $parsed_json->{'location'}->{'city'}; $nowcast = $parsed_json->{'current_observation'}->{'nowcast'}; // Lets make some style classes for your divs $divContainer = "width:{$divWidth};background-color:{$bkgColor};color:{$txtColor};border:{$border} 1px solid;font-size{$fontSize};"; $divHeader = "width:100%;background-color:{$titleBar};"; $divWrapper = "padding: 5px 5px 5px 5px;"; $pStyle = "color:{$titleTxt};margin:0 0 2px 2px;"; // If there is an available message display it $nowCast = "<h3 class='title'>NWS NowCast<span style='float:right'> {$Updated}</span></h3>"; $nowCast = "<hr />"; $nowCast = "<div class='NWSRound'>"; $nowCast = "<div style='{$divWrapper}'> {$nowcast}</div>"; $nowCast = "</div>"; $nowCast = "<table border='0' cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td><img alt='' src='images/1pixel.gif' border='0' height='7' width='7' /></td><td class='shadow-mid' width='100%'><img alt='' src='images/1pixel.gif' border='0' height='7' width='7' /></td><td><img alt='' src='images/1pixel.gif' border='0' height='7' width='7' /></td></tr></tbody></table>"; // If there is no available message then lets display the following $noMessage = "<h3 class='title'>NWS NowCast<span style='float:right'> {$Updated}</span></h3>"; $noMessage = "<hr />"; $noMessage = "<div class='NWSRound'>"; $noMessage = "<div style='{$divWrapper}'> No valid short term forecast for {$location} currently available at this time</div>"; $noMessage = "</div>"; $noMessage = "<table border='0' cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td><img alt='' src='images/1pixel.gif' border='0' height='7' width='7' /></td><td class='shadow-mid' width='100%'><img alt='' src='images/1pixel.gif' border='0' height='7' width='7' /></td><td><img alt='' src='images/1pixel.gif' border='0' height='7' width='7' /></td></tr></tbody></table>"; if(count(json_decode($nowcast,1))==0) { echo $nowCast; } else { echo $noMessage; }
  3. Sorry, hansford for the mis-interpretation, you are correct I meant class selector, not pseudo class. That is what lack of sleep and and previously working with some pseudo classes does. HA! I was actually making it harder than it was. What I ended up doing was this and just breaking it down. // Lets create some styles for the list $ulStyle = "display:inline;padding:15px;"; $liStyle = "display:inline;"; $spanStyle = "background-color:{$alertColor};border:solid 1px #333;width:15px;height:10px;display:inline-block;'> </span><span style='font-size:12px;color:#555;"; //Let's create the list $legend .= "<ul style='{$ulStyle}'>"; $legend .= "<li style='{$liStyle}'><span style='{$spanStyle}'> {$event}</span></li>"; $legend .= "</ul>"; Now my next issue is do I even want to use an unordered list and if so how I can limit it to only 5 before it breaks to a new line or if I want to use a table and use columns instead. I also still need to figure out a way to filter out duplicates. You can see what I mean from the link. http://www.mesquiteweather.net/inc/inc-legend.php
  4. Never mind, I came up with and alternative way.
  5. Usually when you create a variable for a class the variable is your class name. I.E. $var = "your styles here"; echo "<div class='$var'>YADA</div> In this case you can't use ul.alertLegend li as the name of the variable because its a pseudo class So how do I create a variable with a pseudo class?
  6. Hello, is it possible to created a variable for a pseudo class? For example I normally do something like this. $tableWrapper = "background-color:{$alertColor};font-size:12px; padding: 0px 5px 5px 5px;text-align:center;"; Then when I use it in my HTML I would call the variable like so. $tData .= "<div style='{$tableWrapper}'>\n"; But for something like this $ul.alertLegend li Wouldn't work because of the period. Is this possible to do? I really need to be able to do this since the color that will be included in the class is being pulled from an array depending on a certain value. So is it possible to created a variable for for pseudo class? -Thanks
  7. Seeing that form of measurement which is the Richter scale has been used since 1935. I don't see it ever changing as it is the formulated method used worldwide. To change that would be like changing the way you add or substract. So it won't change. The data will always be consistent. So it is irrelevant and the ranges work. You remove Switch ('ANYTHING') then it doesn't work at all. So something has to be there. Doesn't matter what you put but, it has to be something.
  8. Well I was lucky enough to get the same alerts issued tonight as last night so I could troubleshoot and test this further. Strange thing is it worked completely perfect without making any changes as it always had. For safe measures though I did change the variable $title to $atom_title as suggested and it is still working so I will roll with that.
  9. I can see your reasoning in that case but, the data would never be presented in that manner. It will also be 0.1, 0.2, 0.3, 1.1, 1.2, 1.3, etc.... Which is why I set the ranges the way I did to take the dec point into consideration.
  10. The 0-0.9 is mainly there for visual reference on the legend as if it was 0 nothing would show anyways as their is no such data that would be available for 0. Also there is a minimum threshold variable in the script that can be set to not show quakes below a certain richter scale. I.E. $setMinMagnitude = '0.1'; // minimum Richter Magnitude to display because keep in mind 0 will show nothing so it doesn't matter if it shows correctly for as there is no such data that will be returned for 0. I didn't mention this because it was irrelevant and I was trying to keep the question short and sweet. All I needed was a simple way to set the back ground color depending on the magnitude in a certain range. As I have never used a switch with ranges before as I stated in my initial post. What I came up with accomplishes this as it was what was suggested 8 months ago from this board when I first started this script and just got back around to working on it. As you can see the logic flows exactly as I wanted it to with the legend. As you can see 1-1.9 is green, 2-2.9 is yellow and so on. If you were to set each case statement with duplicate whole numbers it would not display correctly. It would show the first instance it came across. Therefore 2 would be green not yellow, which is what it goes from 1-1.9 then 2.9. See example from link. I tested it the other way, it didn't work. I am not trying to argue and I see your point but, it clearly doesn't work. http://www.mesquiteweather.net/wxquake.php It is hard to argue the logic when it is working and it is a very simple script. Could something break? Sure, if my host updates the PHP but even code that is correctly written could have to be changed as I have experienced in the past with numerous PHP5 updates. Now in the spirt of trying other alternatives I have tried your suggestion in another script. It is simply not working based of the examples I had to work with. $LRH_departScale = ''; if ($LRH_calcDepart >= 0 && $LRH_calcDepart < -2) { $LRH_departScale = 'rgb(210, 238, 197)'; } else if ($LRH_calcDepart >= -2 && $LRH_calcDepart < -4) { $LRH_departScale = 'rgb(210, 238, 197)'; } else if ($LRH_calcDepart >= -4 && $LRH_calcDepart < -6) { $LRH_departScale = 'rgb(210, 238, 197)'; } else if ($LRH_calcDepart >= -6 && $LRH_calcDepart < - { $LRH_departScale = 'rgb(210, 238, 197)'; } else if ($LRH_calcDepart >= -8 && $LRH_calcDepart < -10) { $LRH_departScale = 'rgb(210, 238, 197)'; } else if ($LRH_calcDepart >= -10) { $LRH_departScale = 'rgb(210, 238, 197)'; } Now when I remove the $LRH_departScale = ''; I get a undefined error naturally. Just for clarification, $LRH_calcDepart will be static even though it is dynamic content. So for example. if (12 >= 0 && 12 < -2) { $LRH_departScale = 'rgb(210, 238, 197)'; } else if (12 >= -2 && 12 < -4) { $LRH_departScale = 'rgb(210, 238, 197)'; So yes I understand by logic, all those numbers are less than 12. So it could set the $LRH_deparScale to any of those colors. But, since it is checking to see if 12 is within that set range and if it isn't then move on to the one until it is within a range then set that variable to that color for that range. Which I understand where the TRUE statement comes in. If var X is TRUE I.E. within that range then set Y. I am not arguing it is wrong, I am saying it doesn't work.
  11. I don't believe anyone is arguing. In fact, if you read my previous post you will see I tried the example. I clearly asked for a explanation as to why it won't work so I will know further how not to do to it when what I tried clearly does work which is what I have been using for a couple years which was taught to me from a "Senior" member months ago on this board and is in line with the PHP Manual that is so often referred to. So when some people are saying doing it this way and others are saying no that is wrong when it is members from the same board then you can see my dilemma. According to the PHP Manual a is/else statement is just another way to write a switch. It clearly states it in the PHP Manual. So how is it wrong? That is all I was asking. I even tried the example and it still doesn't work. Why do people have to be some demeaning and add nothing to the solution for those who are novice and just do it for fun as a way to relax.
  12. With all due respect, I did not write this script. This was written by a friend of mine about 6-7 years ago who has since passed. It has worked great up until last night. I am very novice when it comes to PHP so what I know I have taught myself and I do not plan on being a career coder. I really do not like asking for help and mainly for the fact no matter what how you do it wether it is right or not. There will be someone else telling you it is wrong. This is a hobby site which I use to learn skills and help unwind from work and kids. I really do not need lectures or to be demeaning statements about how this or that is completely wrong. I have posted code in here before that I have learned from members just to have another other members trash it and say it is completely wrong. I come to this forum because there are some very knowledgable folks who are really helpful. I just believe the criticism can be toned down some especially for those who are not experts and are just looking for a little help. So with that said, your comment added nothing positive or constructive to my question as to what could have caused this. Thank you for your time and reply though. To the others, once I got home I did see there was a duplicate variable of the same name in the top of my site. Not sure why it is just now all of a sudden started causing problems. I like the idea of renaming it and I think that is what I will do. Can't do anymore testing at the moment as there is no alerts. So I will have to wait for the next ones which could be a few days to weeks.
  13. Every switch I have done I have done it this way per the PHP site. That is why I am a little confused as to how it is wrong. I try to self teach myself but, it seems you ask 20 people for suggestions and more than half of them will all tell you something different. If it is working I don't see how it is wrong. if/else is just another way to script it. As for the logic $magnitude >=0 && $magnitude <=0.9 And the second is $magnitude >=1 && $magnitude <=1.9 If you make it a whole number then it will not know which color to use therefore it will be NULL. That is why the ranges are the way they are. This has been tested. less than and more than doesn't exempt the number. So I.E. if the number is 1.9 or less or great than 1 it will include that entire range. It doesn't exclude 1 or 1.9 from than range. If you have two switches using the same range then it would be NULL because it wouldn't know which one to inherit. Again, this as been tested. At them moment it is working correctly with the solution I had posted through numerous testing. In order to continue my learning to fully understand I have tried it with another instance I have. Setting it to TRUE does not work and setting whole numbers does not work. $LRH_departScale = ''; switch(TRUE) { case $LRH_calcDepart >=0 && $LRH_calcDepart <=-2: $LRH_departScale = 'rgb(195, 218, 236)'; break; case $LRH_calcDepart >=-2 && $LRH_calcDepart <=-4: $LRH_departScale = 'rgb(210, 238, 197)'; break; case $LRH_calcDepart >=-4 && $LRH_calcDepart <=-6: $LRH_departScale = 'rgb(244, 240, 202)'; break; case $LRH_calcDepart >=-6 && $LRH_calcDepart <=-8: $LRH_departScale = 'rgb(244, 223, 202)'; break; case $LRH_calcDepart >=-8 && $LRH_calcDepart <=-10: $LRH_departScale = 'rgb(240, 199, 205)'; break; case $LRH_calcDepart >=-10: $LRH_departScale = 'rgb(212, 195, 236)'; break; } Then again this could be how I am embedding it in the HTML as I have tried many numerous ways. <td bgcolor="<?php echo $LRH_departScale; ?>"> <?php echo $LRH_calcDepart; ?></td>
  14. Thanks for the reply, I was only looking at that $title[$i] as well. It doesn't appear to be defined in this script. Which is strange since nothing as change. What are you suggestion is their is another variable named $title when I include it in my page that would be causing this? That is very possible as I have made some changes to the page which it is included. Strange thing is it kills every page when there is an alert, not just one. I will give that a look and see what I can dig up. -Thanks
  15. Hello, I have this script that I have been running a long time that is included in my site with a php include. It reads data from a cached file in an array. I noticed last night something has happened and it won't load in my site anymore and causes my site not to load. I determined this through various troubleshooting. Through the various troubleshooting I was able to get an error "Fatal error: Cannot use string offset as an array in /home4/mesquiu0/public_html/nws_alerts_scroller.php on line 44". This is strange because nothing has changed on my server or with this script. Also if I run it by itself it runs fine. http://www.mesquiteweather.net/nws_alerts_scroller.php but, when I include it in my site it won't load and I get the error. I am not sure what is causing this. I have done some research and it appears to be cause by a key as though it were an array of arrays. I just don't see it though. Here is the portion of the code it is referring to. // IF there are alerts if(!empty($atomAlerts)) { // IF there are alerts usort($atomAlerts, 'a_sort'); // sort locations foreach($atomAlerts as $aak => $aav) { // FOR EACH alert, get the data from the cache file $caav = count($aav); // count alerts for($i=0;$i<$caav;$i++) { // FOR EACH alert // assemble alert data $title[$i][0] = '<b>'.strtoupper($aav[$i][0]).'</b>'; @$adarray[$aav[$i][10].' '.$title[$i][0]] .= ' - <a href="'.$alertURL.'?a=' .$aav[$i][14].'#WA'.$aav[$i][13].'" title=" Details for '.$aav[$i][12] .' '.$aav[$i][0].'">' .$aav[$i][12] ."</a>"; } } } Here is a sample of the cached file the script reads from. $atomAlerts = array ( 'TXZ104' => array ( 0 => array ( 0 => 'Dense Fog Advisory', 1 => 'Expected', 2 => 'Minor', 3 => 'Likely', 4 => 1418136720, 5 => 1418148000, 6 => 'Anderson; Bell; Bosque; Collin; Comanche; Cooke; Coryell; Dallas; Delta; Denton; Eastland; Ellis; Erath; Falls; Fannin; Freestone; Grayson; Hamilton; Henderson; Hill; Hood; Hopkins; Hunt; Jack; Johnson; Kaufman; Lamar; Lampasas; Leon; Limestone; McLennan; Milam; Mills; Montague; Navarro; Palo Pinto; Parker; Rains; Robertson; Rockwall; Somervell; Stephens; Tarrant; Van Zandt; Wise; Young', 7 => 'DENSE FOG IS OCCURRING OVER THE REGION WHICH WILL CREATE VERY HAZARDOUS DRIVING CONDITIONS. SLOW DOWN...USE YOUR LOW BEAM HEADLIGHTS...AND LEAVE PLENTY OF DISTANCE BETWEEN YOU AND THE VEHICLE AHEAD OF YOU.', 8 => '...DENSE FOG ADVISORY NOW IN EFFECT UNTIL NOON CST TODAY... * LOCATION...ALL OF NORTH CENTRAL TEXAS. * VISIBILITY...WIDESPREAD VISIBILITY REDUCTIONS OF LESS THAN 1/4 OF A MILE. VISIBILITIES WILL BEGIN TO IMPROVE AFTER NOON. * IMPACTS...DENSE FOG WILL MAKE DRIVING HAZARDOUS.', 9 => '#F60', 10 => ' <img src="./images/FGY.gif" width="12" height="12" alt="Dense Fog Advisory" title=" Dense Fog Advisory" />', 11 => '56', 12 => 'Collin Co', 13 => '1', 14 => 'TXZ104', 15 => '', ), ), Any idea what might be causing this. I don't see anything right off the bat. Just strange it loads fine alone and the problem only happens and happened out of the blue when I include it in my site. I have tried to isolate it to see what might be conflicting with it but have been unsuccessful. I also would add it only errors and doesn't load when included in my site when there is an alert. Right now there is no alerts at the moment. There was alerts at the time this happened. -Thanks
  16. Why won't it work? It appears to be working fine now with the example above I posted. I believe the myInterval was just a place holder for my variable to check. Once I replaced it with the variable with the data to check it works fine now. So what about it won't work if it is working? I do see the pattern as you're using if/else but, what about the is better than the above? For simplicity I really don't see much of a difference. -Thanks
  17. Thanks for your reply and explanation. To be honest, I don't know what myInterval is ether. This is a small script I started over a year ago and just now revisited. So I am not sure why I had that but, the little I do know, I know it doesn't look right and I believe is what is causing my problems. If/else would make more sense. Is it possible to use less than and great than signs for the range in the switch array? This is what I have changed it to. Seems to be working ok. Would this be ok or correct? -Thanks $magScale = ''; switch($magnitude) { case $magnitude >=0 && $magnitude <=0.9: $magScale = 'rgb(195, 218, 236)'; break; case $magnitude >=1 && $magnitude <=1.9: $magScale = 'rgb(210, 238, 197)'; break; case $magnitude >=2 && $magnitude <=2.9: $magScale = 'rgb(244, 240, 202)'; break; case $magnitude >=3 && $magnitude <=3.9: $magScale = 'rgb(244, 223, 202)'; break; case $magnitude >=4 && $magnitude <=4.9: $magScale = 'rgb(240, 199, 205)'; break; case $magnitude >=5 && $magnitude <=20: $magScale = 'rgb(212, 195, 236)'; break; }
  18. Hello, I am having a small issue with a case switch array that uses a range of data. I am using it to set the background of table cells depending on the data. I.E. 0-0.9, 1-1.9 etc with each one being a different color. Issue I am having is it doesn't change. It sets it based on the first array entry. What might I be missing? This is the first time I have used a case switch with a range. -Thanks $magScale = ''; switch($magnitude) { case myInterval >= 0 && myInterval <= 0.9: $magScale = 'rgb(195, 218, 236)'; break; case myInterval >= 1 && myInterval <= 1.9: $magScale = 'rgb(210, 238, 197)'; break; case myInterval >= 2 && myInterval <= 2.9: $magScale = 'rgb(244, 240, 202)'; break; case myInterval >= 3 && myInterval <= 3.9: $magScale = 'rgb(244, 223, 202)'; break; case myInterval >= 4 && myInterval <= 4.9: $magScale = 'rgb(240, 199, 205)'; break; case myInterval >= 5 && myInterval <= 10: $magScale = 'rgb(212, 195, 236)'; break; }
  19. I got it sorted. //Lets convert the full pool current to actual current depth $LRH_calcTotalDepth = $LRH_totalDepth; $LRH_calcDepart = LRH_calcLevel($LRH_current, $LRH_bankfull); $LRH_currentTotal = $LRH_calcTotalDepth + $LRH_calcDepart;
  20. Hello, I am trying to take the calculations of two variables to create a new data for a new variable. For example..... LRH_calcLevel($LRH_current, $LRH_bankfull); +/- $LRH_totalDepth = $newVar Which should translate to -10.43 Ft +/- 40 = $newVar (-29.57) <----- What I want Instead it is showing up as 10.43 Ft +/- 40 = $newVar (-50.43) <----- How it is displaying which is incorrect Here is the code I am using. The second function is what I am trying to use to create the new variable data based on the calculations above from the data provide via XML. How can I get this to display correctly? -Thanks //Parse Lake Ray Hubbard XML Data $site = simplexml_load_file($LRH_data);{ $LRH_bankfull = '435.5'; $LRH_totalDepth = '40'; $LRH_current = $site->observed->datum[0]->primary; $LRH_vaild = $site->observed->datum[0]->valid; $LRH_updated = DATE("D, M d, g:i a", STRTOTIME($LRH_vaild)); } //Lets calculate the lake depatures from full pool for Lake Ray Hubbard function LRH_calcLevel($LRH_current, $LRH_bankfull) { //Get float values from strings $LRH_current = floatval($LRH_current); $LRH_bankfull = floatval($LRH_bankfull); //Calculate the difference $LRH_calcLevel = $LRH_current - $LRH_bankfull; //Format difference to two decimal places and add 'Ft' $LRH_calcLevelStr = (string) number_format($LRH_calcLevel, 2) . ' Ft'; //If vlaue is positive add a + to beginning if($LRH_calcLevel>0) { $LRH_calcLevelStr = '+'.$LRH_calcLevelStr; } //Return the calculated formatted value return $LRH_calcLevelStr; } ////Lets calculate the lake percentage from full pool for Lake Ray Hubbard $val1 = $LRH_current; $val2 = $LRH_bankfull; $LRH_prec = ( $val1 / $val2) * 100; // 1 digit after the decimal point $LRH_prec = round($LRH_prec, 1); //Lets convert the depature from full pool for Lake Ray Hubbard function LRH_calcDepth($LRH_calcLevelStr, $LRH_totalDepth) { //Get float values from strings $LRH_calcDepthStr = floatval($LRH_calcLevelStr); $LRH_totalDepth = floatval($LRH_totalDepth); //Calculate the difference $LRH_calcDepth = $LRH_calcDepthStr - $LRH_totalDepth; //Format difference to two decimal places and add 'Ft' $LRH_calcDepthStr = (string) number_format($LRH_calcDepth, 2) . ' Ft'; //If vlaue is positive add a + to beginning if($LRH_calcDepth>0) { $LRH_calcDepthStr = '+'.$LRH_calcDepthStr; } //Return the calculated formatted value return $LRH_calcDepthStr; } ////Lets calculate the lake percentage from full pool for Lake Ray Hubbard $val1 = LRH_calcLevel($LRH_current, $LRH_bankfull); $val2 = $LRH_totalDepth;
  21. Thanks for sharing, I am always looking to learn new things. How would that work with with dynamic content though? $downloadedmetar1wind is the orignal variable that has the output that needs to be stripped. So wouldn't you create a new variable instead of using $downloadedmetar1wind? For example shouldn't it be. $wind1 = '$downloadedmetar1wind'; preg_replace is replace static content in your example. That would work fine if that is the only thing that would need to get stripped but, this is dynamic content and the output of $downloadedmetar1wind is never the same.
  22. Thank you Frank_b that works great. I would have never came up with that. I was thinking I would need something simple but, that works too. Also thank you too mengo for taking the time as well. I am still curious about where I missed a whitespace. It looks the same as I posted in my example. -Thanks
  23. Thanks for the response. This is where I get thrown is which combination to use. That makes sense but, I am trying to remove the ( ) and both letters and numbers between that. I tried the suggestion but it doesn't remove anything. Is this correct? $wind = preg_replace('/([\s.]\([\w-]+\))/', '', $downloadedmetar1wind);
  24. This is an easy question for those fluid in PHP and one area I struggle in. I have this variable. $downloadedmetar1wind That outputs this.... S (180 degrees) at 26 MPH (23 KT) I am trying to strip away the (180 degrees) and the (23 KT) so it just reads S at 26 MPH This is what I have done but it isn't removing the brackets and the contents between it. $wind = preg_replace('/([\s.]\([0-9-]+\))/', '', $downloadedmetar1wind); -Thanks
  25. Well dang, it won't let me edit. This will make it even easier. Reference the code above and here is the link to the script. http://www.mesquiteweather.net/inc-lake-levels.php Just focus on the first lake, Ray Hubbard. I need to take the variable that is shown for Departure from the link above which is LRH_calcLevel($LRH_current, $LRH_bankfull); and calculate it with Normal Level from the link above which is, $LRH_totalDepth to give me a new variable with data. I.E. LRH_calcLevel($LRH_current, $LRH_bankfull); +/- $LRH_totalDepth = $newVar How would I do this? -Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.