Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
filter array
<?php //php 7.0.8 $str='{ "@context": [ "https://raw.githubusercontent.com/geojson/geojson-ld/master/contexts/geojson-base.jsonld", { "wx": "https://api.weather.gov/ontology#", "@vocab": "https://api.weather.gov/ontology#" } ], "type": "FeatureCollection", "features": [ { "id": "https://api.weather.gov/alerts/NWS-IDP-PROD-2485744-2320592", "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [ -96.77, 33.84 ], [ -96.76, 33.82 ], [ -96.71, 33.83 ], [ -96.52, 33.82 ], [ -96.5, 33.77 ], [ -96.43, 33.78 ], [ -96.38, 33.73 ], [ -96.39, 33.45 ], [ -96.42, 33.46 ], [ -96.94, 33.54 ], [ -96.94, 33.85 ], [ -96.77, 33.84 ] ] ] }, "properties": { "@id": "https://api.weather.gov/alerts/NWS-IDP-PROD-2485744-2320592", "@type": "wx:Alert", "id": "NWS-IDP-PROD-2485744-2320592", "areaDesc": "Grayson", "geocode": { "UGC": [ "TXC181" ], "SAME": [ "048181" ] }, "references": [], "sent": "2017-08-13T13:18:17+00:00", "effective": "2017-08-13T13:18:17+00:00", "onset": "2017-08-13T13:18:00+00:00", "expires": "2017-08-13T16:15:00+00:00", "ends": "2017-08-13T16:15:00+00:00", "status": "Actual", "messageType": "Alert", "category": "Met", "severity": "Severe", "certainty": "Likely", "urgency": "Expected", "event": "Flood Warning", "sender": "NWS Fort Worth TX", "headline": "Flood Warning issued August 13 at 8:18AM CDT expiring August 13 at 11:15AM CDT by NWS Fort Worth TX", "description": "The National Weather Service in Fort Worth has issued a\n\n* Flood Warning for...\nGrayson County in north central Texas...\n\n* Until 1115 AM CDT\n\n* At 816 AM CDT, Emergency management reported flooding of several\nroadways across Grayson County. While the heaviest rainfall has\nended...excessive runoff will continue to result in\nstreams...creeks and some rivers exceeding their banks across the\narea.\n\n* Some locations that will experience flooding include...\nSherman, Denison, Whitesboro, Howe, Pottsboro, Collinsville,\nWhitewright, Bells, Tom Bean, Knollwood, Dorchester, Eisenhower\nState Park, southeastern Lake Texoma, Southmayd, Sadler and Luella.", "instruction": "A Flood Warning means that flooding is imminent or occurring. Water\nrises will generally be gradual, but flooding of some low water\ncrossings and other low-lying areas near rivers, creeks, and streams\nis expected.", "response": "Avoid", "parameters": { "VTEC": [ "/O.NEW.KFWD.FA.W.0008.170813T1318Z-170813T1615Z/" ], "EAS-ORG": [ "WXR" ], "PIL": [ "FWDFLWFWD" ], "BLOCKCHANNEL": [ "CMAS", "EAS", "NWEM" ], "eventEndingTime": [ "2017-08-13T16:15:00Z" ] } } }] }'; $o=json_decode($str,true); $features=$o['features']; $filtered= array_filter($features,function($el){ $alerts = array('Tornado Warning', 'Severe Thunderstorm Warning', 'Flash Flood Warning', 'Flood Warning'); return in_array($el['properties']['event'],$alerts);}); print_r($filtered); ?>
run
|
edit
|
history
|
help
0
Orders
index.php
repair
BOOST TIK TOK
PHP - Balanced Parenthesis using Stack Implementation
reno
HW 2
Website url validation using php
binsearch
123