整数没有被显示为die()参数? [英] Integer is not being shown as die() argument?

查看:157
本文介绍了整数没有被显示为die()参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个奇怪的问题。调试时,我有一些代码看起来像这样

 <?php 
$ var = 15;
die($ var);

die()功能有效,但输出没有什么



但是,这个工作

 <?php 
$ var = 15;
die($ var。< - );

http://sandbox.phpcode.eu/g/81462.php



怎么可能?我错过了什么?或者是错误?

解决方案

请参阅 http://www.php.net/manual/en/function.exit.php (die()等效于exit())


如果状态是字符串,则此功能会在退出之前打印状态。



如果状态是一个整数,该值将被用作退出状态,而不是打印。退出状态应在0到254之间,退出状态255由PHP保留,不得使用。状态0用于成功终止程序。



I have this strange problem. When debugging, I have sometimetimes code looking like this

<?php
$var = 15;
die($var);

die() function works, but outputs nothing

However, this one works

<?php
$var = 15;
die($var."<-");

http://sandbox.phpcode.eu/g/81462.php

How is it possible? Did I miss something? or is it bug?

解决方案

See http://www.php.net/manual/en/function.exit.php (die() is equivalent to exit())

If status is a string, this function prints the status just before exiting.

If status is an integer, that value will be used as the exit status and not printed. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully.

这篇关于整数没有被显示为die()参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆