You are here: Re: break apart a variable « PHP Programming Language « IT news, forums, messages
Re: break apart a variable

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация