What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP Help

PHP Help
Author: Message:
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
34 / Male / –
Joined: Jun 2004
RE: PHP Help
I guess you could return the result up through the functions, like this:
code:
class bin2dec{

function main($invoer){
if(isset($invoer) && $invoer != ""){
return $this->substr($invoer);
}else{
die("ERROR 0x001");
}
}
function substr($invoer){
for($i=0; $i<strlen($invoer); $i++){
$uitvoer[] = substr($invoer,$i,1);
}
return $this->calculate($uitvoer);
}
function calculate($invoer){
$pw=count($invoer) - 1;
for($i=0; $i<count($invoer); $i++){
$uitvoer[] = $invoer[$i] * pow(2, $pw);
$pw--;
}
return $this->addall($uitvoer);
}
function addall($invoer){
$uitvoer=0;
for($i=0; $i<count($invoer); $i++){
$uitvoer = $invoer[$i] + $uitvoer;
}
return $uitvoer;
}
}

But it would make more sense to just have all the code in the one main function.

This post was edited on 01-20-2006 at 05:36 PM by Plik.
01-20-2006 05:36 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP Help - by Ezra on 01-20-2006 at 05:11 PM
RE: PHP Help - by Plik on 01-20-2006 at 05:24 PM
RE: PHP Help - by Ezra on 01-20-2006 at 05:30 PM
RE: PHP Help - by Plik on 01-20-2006 at 05:36 PM
RE: PHP Help - by Ezra on 01-20-2006 at 05:41 PM
RE: PHP Help - by segosa on 01-20-2006 at 08:53 PM
RE: PHP Help - by J-Thread on 01-20-2006 at 10:23 PM
RE: PHP Help - by Ezra on 01-20-2006 at 10:31 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On