array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.ob-get-length.php', 1 => 'ob_get_length', ), 'up' => array ( 0 => 'ref.outcontrol.php', 1 => '出力制御 関数', ), 'prev' => array ( 0 => 'function.ob-get-flush.php', 1 => 'ob_get_flush', ), 'next' => array ( 0 => 'function.ob-get-level.php', 1 => 'ob_get_level', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/outcontrol/functions/ob-get-length.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
ob_get_length — 出力バッファの長さを返す
この関数にはパラメータはありません。
出力バッファの内容の長さをバイト単位で返します。
出力のバッファリングがアクティブでない場合には、false
を返します。
例1 単純な ob_get_length() の例
<?php
ob_start();
echo "Hello ";
$len1 = ob_get_length();
echo "World";
$len2 = ob_get_length();
ob_end_clean();
echo $len1 . ", " . $len2;
?>
上の例の出力は以下となります。
6, 11