PHP

サンプルコード
function arr2xml($data, $root = true){
$str=””;
if($root)$str .= “<xml>&# ...

PHP

PHPコード:
<?php
$str=array(4,8,2,7,10,0,3,12,11);
for ($I = 0; $I <= count($str); $I++) if (in_array( ...

PHP

1.round()
echo round(3.4);//3
echo round(3.5);//4
echo round(3.6);//4
echo round(3.6, 0);//4
echo ...

PHP

PHPコード:
$rand = mt_rand(0,1);
if( $rand==0 )
{
$array = array(36,35,16,29,30);
}
elseif( $ran ...

PHP

phpコード
<?php
//USER AGENTを取得
$agent = strtolower($_SERVER);
//データを分析
$is_pc = (strpos($agent, ...

PHP

phpコード:
<?php function devicetype_get(){
$agent = strtolower($_SERVER);
$type = ‘other’; ...

PHP

PHPコード
<?php
header(‘HTTP/1.1 200 OK’);
header(‘HTTP/1.1 404 Not Found’);

PHP

サンプル1
<?php
$filename = “/var/www/st24.txt”;
$ctlp = fopen($filename, “r”); ...

PHP

PHPコード:
function getPostDataInfo(array $_data = array(),$n = ”){
$postData = empty($_data) ? I(‘p ...

PHP

PHPコード
function getHeadersInfo($url,$data=FALSE){
$_headers = get_headers($url,1);
if( !$data ){
retu ...

PHP

PHPコード
<?php
$host = “172.17.100.21”;
$user = “root”;
$pwd = “pwdStr ...

PHP

phpコード
$doc = new DOMDocument();
$doc->load( ‘kdfc.xml’ );
$students = $doc->getElementsByTagName( ...

PHP

PHPコード
class TcpPortCheck {
public static $status;
public function __construct()
{
}
public f ...

PHP

方法1
function randStrGet($len)
{
$chars=”ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvw ...

PHP

phpコード例1
<?php
define(“STUDYPHP”,”startnews24″);
class CftConstDemo
{

PHP

1.file_get_contents
<?php
$url = “
$contents = file_get_contents($url);

//$getcontent = ic ...

PHP

phpコード
try {
$dbh = new pdo(‘mysql:host=localhost;dbname=dbtest’, ‘root’, “); ...

PHP

phpコード:
$dsn = ‘mysql:dbname=ent;host=172.17.20.100′;
$user = ‘root’;
$password = ̵ ...