Checking an array against user input?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I am new to this news group, and figured this was the fastest way to get a good, helpful answer. Here is my problem:

I have an array that I set up with numbers 00 thru 99. Now, I have some timestamps that look somewhat like this:

[00:01:70]
[00:06:50]
[00:12:07]
[00:15:04]
[00:19:75]

I am making a script that will convert them into this:

[00:01.70]
[00:06.50]
[00:12.07]
[00:15.04]
[00:19.75]

(notice the period ( . ) instead of the colon ( : ) after the fourth number)

My problem is that I don't know how to achieve this. This is the code I have so far:

$nums = array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "00");
$x = array_search($nums,$nums);

$format1 = array("[$x:$x:$x]", "[$x:$x.$x]");
$format2 = array("[$x:$x.$x]", "[$x:$x:$x]");


It is linked up with a textbox and a button if that matters any. I just need to beable to have the script look at the array, and match it with whatever the user types in. Unless there is a different way to get what I need?

Thank you,

Keikonium
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux