php - Using explode on a variable that doesn't have quotes -


i have line grabs data web database, outputting this:

kjfk 180451z 23007kt 10sm clr 27/22 a3008 rmk ao2 slp184 t02670222 403500261

(note, string changes per hour on dynamic basis).

that string there has more information want displayed in end. let's want display 23007kt.

i thinking of doing $elements = explode(" ", $metar);

note: $metar defined action gets long string. <td><?php $a = $ad[icao]; $metar = get_metar(strtoupper($a)); ?> </td>

i think issue need add quotes beginning of long string. have tried putting 1 of these strings, quotes, , works, useful hour (because change after time)

i have tried doing $elements = explode(" ", "$metar"); no success.

how go adding in quotes beginning of string?

thanks.

try , works me,

$metar='kjfk 180451z 23007kt 10sm clr 27/22 a3008 rmk ao2 slp184 t02670222 403500261'; $elements = explode(" ", $metar); //print_r($elements); echo $elements[2];//outputs 23007kt 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -