php教程|php手册
php,阿拉伯数字,罗马数字,转换
php教程-php手册
免费优惠券php网站源码,ubuntu打开文件编辑,爬虫批量导出数据,php 数组添加,seo查询 aizhanlzw
这篇文章主要介绍了php实现阿拉伯数字和罗马数字相互转换的方法,涉及php字符串操作的相关技巧,具有一定参考借鉴价值,需要的朋友可以参考下
144g源码1.4,vscode如何提醒框架代码,ubuntu视频监控,tomcat8 8080,爬虫式 街舞,php邮件批量发送邮件,池州seo优化哪家服务好,网站链接后面style.css v,网站模板破解版lzw
在线销售系统源码下载,vscode没有报错功能,ubuntu分区boot,tomcat部署web目录,航班爬虫,php layout,seo前端优化分类,门户新闻文章资讯类网站,婚纱cms模板lzw
本文实例讲述了php实现阿拉伯数字和罗马数字相互转换的方法。分享给大家供大家参考。具体如下:
3999 || $f 1000,
‘D’ => 500,
‘C’ => 100,
‘L’ => 50,
‘X’ => 10,
‘V’ => 5,
‘I’ => 1
);
// Calculate the needed roman figures:
foreach($roman as $k => $v)
if(($amount[$k] = floor($f / $v)) > 0)
$f -= $amount[$k] * $v;
// Build the string:
$return = ”;
foreach($amount as $k => $v)
{
$return .= $v 1000,
‘D’ => 500,
‘C’ => 100,
‘L’ => 50,
‘X’ => 10,
‘V’ => 5,
‘I’ => 1
);
// Convert the string to an array of roman values:
for($i = 0; $i $current ? $sum += $next – $current + 0 * next($values) : $sum += $current;
}
// Return the value:
return $sum;
}
// echo roman2dec(IX);
?>
,