Skip to content

Instantly share code, notes, and snippets.

張 建文 chang180

Block or report user

Report or block chang180

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chang180
chang180 / diamond.html
Last active Mar 27, 2020
印星星-菱形
View diamond.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
@chang180
chang180 / rev
Last active Mar 26, 2020
中文字串反轉
View rev
$str = '字串反轉';
function rev($str, $encoding = 'utf-8'){
$len = mb_strlen($str);
$result = '';
for ($i = $len-1; $i>=0; $i--){
$result.= mb_substr($str,$i,1,$encoding);
}
return $result;
}
echo rev($str);
View lottery.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>威力彩_php</title>
</head>
<body>
<h2>
<?php
@chang180
chang180 / today
Created Mar 23, 2020
JavaScrpit output date
View today
<script language="javascript">
 var Today=new Date();
 document.write(Today.getFullYear()+ "/" + (Today.getMonth()+1) + "/" + Today.getDate());
</script>
@chang180
chang180 / calPi.php
Last active Mar 22, 2020
PI calculation
View calPi.php
<?php
// 圓周率計算,以蒙地卡羅演算法處理
function calPi($num){
$c=0;
$s=0;
for($i=1;$i<=$num;$i++){
if(sqrt(pow(rand(0,$num),2)+pow(rand(0,$num),2)) <= $num ){
$c+=1;
$s+=1;
You can’t perform that action at this time.