Posted by Rik on 02/07/07 16:09
Auddog <will_k@hotmail.com> wrote:
> I would like to know how I can break apart a variable. I'm currently
> passing the variable $id-hours and I would like to break it down. I =
> would
> like to break down to something similar to:
>
> $eid =3D id (id part of $id-hours)
> $ehour =3D hours (hours part of $id-hours)
How is $id-hours formatted?
> Is this possible? I'm new to programming and just trying to get thru =
it
> all. Thanks for any help that you may be able to provide.
Several functions come to mind. You might want to use one of these:
- explode()
- fscanf()
- split()
- preg_match()
Not much else I can say without knowing the format.
Also, why do you have this in 1 variable? More logical would be:
$var =3D array('id'=3D> 'your_id','hours' =3D> 'your_hours', 'foo' =3D> =
'bar');
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|