Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

PHP | join

概要

join

詳細

join関数で配列を文字列として連結する。任意のセパレータを指定可能。

サンプル

#!/usr/bin/env php
<?php
$hoges = array('hoge', 'hige', 'hage');
print_r(join("\n", $hoges));

出力

hoge
hige
hage

Rubyと比較

# encoding: utf-8
print %w{hoge hige hage}.join("\n")