Using function outputstring as multiple input

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
burgerr
Forum Newbie
Posts: 1
Joined: Fri Nov 05, 2010 1:34 am
Location: Zoetermeer, The Netherlands

Using function outputstring as multiple input

Post by burgerr »

Hi there. Perhaps tiring question from a newbie.

Is it possible to use an output string from one function as an input for another function?

example i'm converting a color hex code to rbg values an use the as multiple input for anoher function.
$hexshizzle = "#006600";
setrgbcolor(hex2rgb($hexshizzle));
input needed is setrgb(0, 102, 0) //numeric values
output from hex2rgb is "0,102,0"

is this a valid construction? it does not seem to work.

Regards,
Rutger
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Using function outputstring as multiple input

Post by AbraCadaver »

What do you mean by "output", hex2rgb() actually echos those values to the screen? You would be better to return an array of the three values from hex2rgb() and pass that to setrgbcolor(). There are other ways but they will be hackish.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply