<?php
function showMe($p_var , $p_bReturn=false){
$style = 'style="background:#E6FFE6; color:#0000A0; border:1px blue dotted; padding:10 10; text-align:left" ';
$pre = "<pre ".$style.">\n%s\n</pre>\n";
if(is_scalar($p_var)){
$strResult = $p_var;
}else{
$strResult = @print_r($p_var,true);
if(empty($strResult)){
// test if second paramates is working
$retTest= @print_r( array("10") , true);
if(empty($retTest)){
// not working capture the output
ob_start();
@print_r($p_var);
$strResult=ob_get_contents();
ob_end_clean();
}
}
}
if($p_bReturn===false){
print sprintf($pre,$strResult);
}else{
return $strResult;
}
}
#
require_once "PBNR.inc.php";
$bnr=new PBNR();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Insert title here</title> </head> <body> <?
# get the entire array
showMe($bnr->get());
# get the currency date
showMe($bnr->get('date'));
# get the USD value from the array
showMe($bnr->get('usd'));
# get the EUR value from the array
showMe($bnr->get('eur'));
?> </body> </html>
|