PHP函式:http://overapi.com/php/
Ruby函式:http://overapi.com/ruby/
Ruby 1.9.3 API:http://www.ruby-doc.org/core-1.9.3/
Ruby 2.0 API:http://www.ruby-doc.org/core-2.0/
PHP | Ruby | 功能 |
---|---|---|
trim | strip | 去除字串空白 |
namespace | Module | 名稱空間 |
__construct | initialize | 建構子 |
private $variable | @variable | 私有變數 |
array_push($target , $variable); | target << variable | 變數推送 |
require "Filename.php" | require_relative "Filename" | 引用檔案 |
throw new Exception try catch | raise EXCEPTIONNAME begin rescue EXCEPTION |
例外處理 |
$target = strtolower($str) $target = strtoupper($str) |
target = str.downcase target = str.upcase |
大小寫轉換 |
explode("," , $source) substr($source,from,length) |
source.split "," source.slice() |
字串切割 |
in_array($str,$check) | check.include? str | 陣列資料存在確認 |
array_push($target,$data) $target[] = $data |
target.push data target << data |
陣列資料推送 |
join(",",$source) | source.join "," source * "," |
陣列資料合併 |
沒有留言:
張貼留言