Jump to content

php help


STARs

Recommended Posts

hi

i want to count the number of Pauses in a particulor PIREP could you guide me how can i do that.

i.e

SIMULATOR PAUSED

SIMULATOR UN-PAUSED

SIMULATOR PAUSED

SIMULATOR UN-PAUSED

SIMULATOR PAUSED

SIMULATOR UN-PAUSED

Total Pauses: 3

I want to count the number of SIMULATOR PAUSED in a log file.

Please guide.

Link to comment
Share on other sites

Try this...

<?php
echo substr_count($pirep->log,"paused");
?>

Thanks it works. Could you also guide me the following:

1. how can i like make the pauses count font red like if the toal pauses are more than 10 it should show it as red in PIREP.

2. I want to show in PIREP Rank check I mean if pilot has flown according to his rank than it should say OK otherwise it should show in RED no.

Thanks!

Link to comment
Share on other sites

1.

<?php
$pause_count = substr_count($pirep->log, "paused");
if ($pause_count > 10)
{
echo '<span style="color:red">Paused '.$pause_count. ' times.</span>';
}
else {
echo 'Paused'. $pause_count. ' times.';
}
?>

Thank's it worked. Waiting for the second one....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...