You are here: Re: Use parameters within a Function, please help me « PHP Programming Language « IT news, forums, messages
Re: Use parameters within a Function, please help me

Posted by Jerry Stuckle on 11/17/06 11:45

BabyBlue wrote:
> I have a function like this:
> function get_articles($cat=1,$numberposts=1);
>
> it can be used:
> get_articles(cat=4&numberposts=6);
> //will display 6 posts from category 6
>
> then I want to use that function within another function, like this:
>
> function display_cat($new_cat=1,$new_num=1,$othercontent="")
> {
> get_articles(cat=$new_cat&numberposts=$new_num)
>
> ......
> }
>
>
> Can I pass function like this ?
>

No, you are incorrect. You would call it with:

get_articles(4, 6);

"cat=4&numberposts=6" is strictly an HTML implementation. It's not used
within functions like this.

So in your display_cat function, you would call it with

get_articles($new_cat, $numberposts);

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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