Bitcoin Forum
November 14, 2018, 06:52:19 PM *
News: Latest Bitcoin Core release: 0.17.0 [Torrent].
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Splitting arrays from an RPC call  (Read 20 times)
The_Trader
Member
**
Offline Offline

Activity: 74
Merit: 28


View Profile
June 10, 2018, 02:25:00 AM
 #1

I'm trying to split the rpc call
Code:
print_r($bitcoin->getdifficulty());

If you take a look here it looks shitty http://91.121.133.197/test

Is the a way for me to print or display the POS diff and the POW diff on there own ?

Many Thanks
TT
1542221539
Hero Member
*
Offline Offline

Posts: 1542221539

View Profile Personal Message (Offline)

Ignore
1542221539
Reply with quote  #2

1542221539
Report to moderator
1542221539
Hero Member
*
Offline Offline

Posts: 1542221539

View Profile Personal Message (Offline)

Ignore
1542221539
Reply with quote  #2

1542221539
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1542221539
Hero Member
*
Offline Offline

Posts: 1542221539

View Profile Personal Message (Offline)

Ignore
1542221539
Reply with quote  #2

1542221539
Report to moderator
btj
Member
**
Offline Offline

Activity: 106
Merit: 14


View Profile
June 10, 2018, 06:31:42 PM
 #2

You will get more answers from here:
https://bitcointalk.org/index.php?board=4.0

Supposing you get this result:
Code:
Array ( [proof-of-work] => 6.2216203 [proof-of-stake] => 3.62663766 [search-interval] => 1 )

When you make:
Code:
print_r($bitcoin->getdifficulty());

To display them separately:
Code:
<?php
$difficulty 
$bitcoin->getdifficulty();

// Show PoW
echo $difficulty["proof-of-work"];

// Show PoS
echo $difficulty["proof-of-stake"];
?>

Learn basics of Arrays from here:
http://php.net/manual/en/language.types.array.php
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!