how to count 1 tone from , to ,

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GK
Forum Commoner
Posts: 51
Joined: Sat Jun 07, 2003 2:58 pm
Contact:

how to count 1 tone from , to ,

Post by GK »

Hi all

i count my tones in my ringtones with this

<?php

if(strlen($site_rtttl)>$site_check) {

?>

Site check contains the value (ex. 220)
but this check the caracters and i need to get the tones

This is whats inputted (an example rtttl)

Dearm:d=16, o=5, b=90:4a, 8g, f, 4p, 8p, 4a, 8a#, 8a, 8g, 8f, 8g, 8a, 8p, 4a, 8g, f, 4p, 8p, 4a, 8a#, 8a, 8g, 8f, 8g, 8a, 8p, 4a, 8g, f, 4p, 8p, 4a, 8a#, 8a, 8g, 8f, g,


Dearm = name
d= duration
o= something LOL
b= speed
then each tone is seperated bij ,

How do i count starting at : and then 1 count is from , to ,

?? :?:
User avatar
m@ndio
Forum Regular
Posts: 163
Joined: Fri Jun 06, 2003 12:09 pm
Location: UK

Post by m@ndio »

why are you using strlen if the value of $site_rtttl is numeric? strlen count the number of characters in a string...
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

umm.. try....

Code: Select all

<?php
$temp=explode($site_rtttl, ',');
foreach($temp as $value){
  $value=trim($value);
}
?>
now it is an array... entries look like....
Dearm:d=16
o=5
b=90:4a
8g
f
4p
...


count($temp); is, fromt he sound of it, what you're alooking for (not the length of the string)
and since you know the first 3 are always
Dearm:d=16
o=5
b=90:4a
you can figure out that count($temp)-3; is what you want if you want ot skip them. if you want to evaluate something you can easily skip over to the point you want to evaluate if there's other parts set
User avatar
m@ndio
Forum Regular
Posts: 163
Joined: Fri Jun 06, 2003 12:09 pm
Location: UK

Re: how to count 1 tone from , to ,

Post by m@ndio »

Site check contains the value (ex. 220)
but this check the caracters and i need to get the tones
didn't see that sorry .. :oops:
Post Reply