<(|:i?北京pk10新凤凰哪里可以玩|)>

PHP: I find the PHP equivalent of &cfdump& on GitHub shortly after I p ...
(window.slotbydup=window.slotbydup || []).push({
id: '2611110',
container: s,
size: '240,200',
display: 'inlay-fix'
您当前位置: &
[ 所属分类
| 时间 2015 |
作者 红领巾 ]
Sometimes I don't know why I bother. Oh well: at least I know more about Composer now. That's useful.
Forever, there's been a implementation of &cfdump& , over at / . As good as that is, I didn't want to "install" it via downloading the file and sticking it into our codebase, I decided the better approach would be to work out how to package it up and install it via composer. That's why I was horsing around with Composer for the last coupla days (" PHP: trying (but not succeeding) to create my own Github-based Composer Package " and " PHP: Fixed! My colleague sorts that Composer issue out for me ").
So I grabbed dBug.php and stuck it in a Github repo (not in a James Harvey sort of way , I acknowledged the authorship of the code appropriately), and worked out how to load it via Composer and all the rest of that bullshit. I was knocking together the test code for this article when I did a slightly different Google search than usual and... found the version of it already on GitHub. Sigh. It's over here: /ospinto/dBug .
Oh well. Anyhow, in case yer a PHP person and don't know about &cfdump& , I'll write up the demo code anyhow.
Here we go:
// dump.php
require_once __DIR__ . '/../vendor/autoload.php';
$o = new dump\C('publicProperty value', 'protectedProperty value','privateProperty value');
'string' =& 'a string',
'object' =& $o,
'array' =& $o-&getProperties()
new dBug($v);
This outputs as follows:
Oh... C is defined thus:
public $publicP
protected $protectedP
private $privateP
function __construct($publicProperty, $protectedProperty, $privateProperty){
$this-&publicProperty = $publicP
$this-&protectedProperty = $protectedP
$this-&privateProperty = $privateP
public function getProperties(){
return $this-&getAsArray();
private function getAsArray(){
'public' =& $this-&publicProperty,
'protected' =& $this-&protectedProperty,
'private' =& $this-&privateProperty
It just demonstrates the difference in handling non-public elements of objects.
That shits all over var_dump() :
array(3) {
["string"]=&
string(8) "a string"
["object"]=&
object(dump\C)#2 (3) {
["publicProperty"]=&
string(20) "publicProperty value"
["protectedProperty":protected]=&
string(23) "protectedProperty value"
["privateProperty":"dump\C":private]=&
string(21) "privateProperty value"
["array"]=&
array(3) {
["public"]=&
string(20) "publicProperty value"
["protected"]=&
string(23) "protectedProperty value"
["private"]=&
string(21) "privateProperty value"
So... yeah... that's it. I dunno how I didn't find the GitHub version earlier. All in all it was a helpful exercise, and hopefully I can coerce my Team Lead to let us integrate this with our dev environment.
I'm also gonna work out how to implement this as a Twig Extension too... but first I'll google to see if it'-)
本文开发(php)相关术语:php代码审计工具 php开发工程师 移动开发者大会 移动互联网开发 web开发工程师 软件开发流程 软件开发工程师
转载请注明本文标题:本站链接:
分享请点击:
1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
CodeSecTeam微信公众号
每一次烦恼的出现,都是一个给我们寻找自己缺点的机会。
手机客户端99+条站内信
1条系统消息
& I.O.I & Crush〞
正在加载歌曲,请稍等...
& I.O.I & Crush〞}

我要回帖

更多关于 北京pk10龙虎 新凤凰 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信