`
sillycat
  • 浏览: 2539224 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

PHP Backend Application(1)Env and PHP Knowledge

 
阅读更多
PHP Backend Application(1)Env and PHP Knowledge

Check the PHP version
> php --version
PHP 5.6.16 (cli) (built: Dec 26 2015 18:37:18)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans

The comments style is similar to Java, file starter and end are like this
<?php
  echo "php runs first!";
  echo "\nrecall my php knowledge"; // one line comments
  /*
   this is how th comments go in java
  */
?>

Types
Four scalar type: boolean, integer, float, string
Two compound types: array, object
Two special types: resource, NULL

Check the type and get type
<?php
$a_boolean = TRUE;
$a_string = "foo";

echo gettype($a_boolean);
echo "\n";
echo var_dump($a_string);
echo is_string($a_string);
echo "\n";

?>

console output is as follow:
boolean
string(3) "foo"
1

Cast other value to boolean
var_dump((bool) 1);         // bool(true)
var_dump((bool) -2);        // bool(true)

Automatically covert the int to float
$large_number = 2147483647;

var_dump($large_number);                     // int(2147483647)

$large_number = 2147483648;
var_dump($large_number);                     // float(2147483648)

Single Quoted for String
// Outputs: This will not expand: \n a newline

echo 'This will not expand: \n a newline';

// Outputs: Variables do not $expand $either
echo 'Variables do not $expand $either';

Double Quoted

Heredoc
$str = <<<EOD

Example of string
spanning multiple lines
using heredoc syntax.
EOD;

nowdoc is single quoted heredoc
echo <<<'EOT'

My name is "$name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should not print a capital 'A': \x41
EOT;

Environment and Types
> cat type.php
<?php
$arr = array("foo"=>1, 12=>true);
echo gettype($arr[12])."\n";
echo $arr[12]."\n";
?>

> php type.php
boolean
1

unset($arr[5]); // This removes the element from the array
unset($arr);    // This deletes the whole array

As mentioned above, if no key is specified, the maximum of the existing integer indices is taken, and the new key will be that maximum value plus 1.

A lot of useful array operations are here http://sillycat.iteye.com/blog/1543227

The unset() function allows removing keys from an array. Be aware that the array will not be reindexed.

The array_values() function can be used to 'remove and shift'.
$a = array(1 => 'one', 2 => 'two', 3 => 'three');
unset($a[2]);
/* will produce an array that would have been defined as
   $a = array(1 => 'one', 3 => 'three');
   and NOT
   $a = array(1 => 'one', 2 =>'three');
*/
print_r($a);
echo "<br />";
$b = array_values($a);
// Now $b is array(0 => 'one', 1 =>'three')
print_r($b);

http://sillycat.iteye.com/blog/2302285

Code Standard
http://sillycat.iteye.com/blog/2194084

PHP with FPM
http://sillycat.iteye.com/blog/2223621

PHP Lumen
http://sillycat.iteye.com/blog/2238841
http://sillycat.iteye.com/blog/2239826

Install latest PHP on EC2
http://sillycat.iteye.com/blog/2302287

UNIT Test
http://sillycat.iteye.com/blog/2302288

> phpunit --version
PHPUnit 5.1.3 by Sebastian Bergmann and contributors.

References:
PHP Basic1 ~ 3
http://sillycat.iteye.com/blog/768664
http://sillycat.iteye.com/blog/769110
http://sillycat.iteye.com/blog/770369

PHP 1~ 8
http://sillycat.iteye.com/blog/1543227
http://sillycat.iteye.com/blog/2066063
http://sillycat.iteye.com/blog/2302285
http://sillycat.iteye.com/blog/2194084
http://sillycat.iteye.com/blog/2223621
http://sillycat.iteye.com/blog/2238841
http://sillycat.iteye.com/blog/2239826

Language References
http://php.net/manual/en/langref.php

PHP Env
http://sillycat.iteye.com/blog/1634562
http://sillycat.iteye.com/blog/1638638
分享到:
评论

相关推荐

    开源项目-1backend-1backend.zip

    1backend 是一个开源项目,它采用了先进的技术栈,包括 Go 语言和 Angular 2(现称为 Angular),构建了一个平台即服务(PaaS)系统。这个项目的目标是提供一个高效、可扩展且易于使用的云基础设施,使得开发者能够...

    Mastering The Faster Web with PHP, MySQL, and JavaScript 1st pdf

    Ensure seamless implementation of a JavaScript & HTML 5 CSS based frontend and PHP based backend. Learn about problem identification, best strategies, and UI design patterns as well to build a clean, ...

    Backend_Application

    在项目"Backend_Application-main"中,我们可以期待找到与上述知识点相关的源代码、配置文件和资源。通过阅读和分析这些内容,可以深入理解一个基于Java的后端应用是如何设计和实现的。开发者可能还使用了Maven或...

    Kilin9527#Frontend_And_Backend_Knowledge#typescript-1 基础部分1

    1. 字符串 2. 数组 4. 类型断言 5. 对象的解构与重命名 1. 字符串 2. 数组 4. 类型断言 5. 对象的解构与重命名

    Full-Stack Vue.js 2 and Laravel 5 Bring the frontend and backend together epub

    Full-Stack Vue.js 2 and Laravel 5 Bring the frontend and backend together with Vue, Vuex, and Laravel 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网...

    PHP Microservices

    Learn about application design and structure to start implementing your application. Transform a monolithic application into microservices. Explore the best way to start implementing your application ...

    天才宝宝游泳中心后台Koa框架-TCBB-backend-v1.zip 开发 java

    天才宝宝游泳中心后台Koa框架_TCBB_backend_v1.zip 天才宝宝游泳中心后台Koa框架_TCBB_backend_v1.zip 天才宝宝游泳中心后台Koa框架_TCBB_backend_v1.zip 天才宝宝游泳中心后台Koa框架_TCBB_backend_v1.zip 天才宝宝...

    php form generator mysql db backend

    php mysql html form generator using this script you can generate html form for your website and it gives out php script and mysql db schema for you to use with out any coding knowledge

    Learning Node.js for Mobile Application Development(PACKT,2015)

    the book ends with more advanced projects, which will bring together all the knowledge and expertise developed in the previous chapters to create a practical and functional mobile-application that ...

    基于PHP和JavaScript的悟空帮扶-backend设计源码

    该项目是一个基于PHP和JavaScript的悟空帮扶-backend系统设计源码,包含3086个文件,其中包括1221个JavaScript文件、554个PHP文件、334个HTML文件、259个LESS样式文件、144个PNG图片文件、112个JSON文件、98个CSS...

    Laravel开发-laravel-backend

    ### 1. Laravel 框架基础 Laravel 的核心特性包括路由、控制器、中间件、模板引擎(Blade)以及数据库访问层(Eloquent ORM)。它简化了常见的Web开发任务,如表单验证、会话管理和身份验证,使开发者能够更专注于...

    php酒店医院等各行业预约原生源码

    1. `.gitignore`:这是一个版本控制系统Git的配置文件,用于指定在提交时忽略的文件和目录,以避免将无用或敏感信息推送到远程仓库。 2. `index.html`:这是Web应用的入口文件,通常包含HTML结构,用于展示网站的...

    PHP Reactive Programming

    The book will then focus on writing extendable RxPHP code by developing a code testing tool and also cover Using RxPHP on both the server and client side of the application. With a concluding chapter...

    desafio-php-backend:php后端挑战

    cp .env.example .env 为laravel应用程序生成一个新密钥 php artisan key:generate 运行迁移以创建数据库 php artisan migrate 运行seeder在基础上创建一些用户 php artisan db:seed 运行控制器测试 php artisan ...

    short:用Go和React编写的URL缩短服务

    将backend/.env.dist文件复制到backend/.env : cp backend/.env.dist backend/.env 将frontend/.env.development.dist文件复制到frontend/.env.development : cp frontend/.env.development.dist frontend/.env...

    lorawantm-backend-interfaces-v1.0.pdf

    This describes the standard interfaces and message flow between: 1) A Network Server and a Join Server 2) a Join Server and an Application Server 3) Two Network servers in the case of roaming traffic ...

    Tkinter GUI Application Development HOTSHOT(PACKT,2013)

    building real-world, productive and fun applications like text editor, drum machine, game of chess, media player, drawing application and many more. Each subsequent project builds on the skills ...

    digitalinnovationone_backend_php:Bootcamp后端PHP数字创新1

    【标题】"digitalinnovationone_backend_php:Bootcamp后端PHP数字创新1"指的是一个针对数字创新领域,专为提升后端PHP技能的训练营项目。这个项目可能旨在帮助开发者和学习者掌握PHP语言在构建现代Web应用中的核心...

Global site tag (gtag.js) - Google Analytics