English 中文(简体)
是否有可能在《综合框架》中使用全球变量?
原标题:Is it possible do use global variables in IF s?

能否在同一《综合框架》的另一部分获得一个在《综合框架》中界定的变量?

页: 1

if ($a == 1)
{
  $b = "ABC";
}
elseif ($a == 2)
{
 echo $b;
}

在职能一使用时,全球可变,但《国际会计和报告准则》一则专有。

The reason why i m asking this its because i m making a registration page step-by-step.
It means that i need to check for that If-statement a lot of times and in my final step i need to gather all variables from all IFs.

最佳回答

There are no "global" variables the way you understand them.
All the PHP variables doomed to die with all the PHP script after it s execution.

You need some storage to keep your variables between requests.
PHP sessions is a good choice.

问题回答

国际不动产业联合会在《规则》中的陈述确实有:>不是>《标准/范围》的变动范围――不同于一项功能。 因此,只要你在同样的范围内,你在《国际自由论坛》中所做的任何事情都会在外面看到。 你们不需要使用GLOBAL。 的确,应当尽可能少地利用全球范围。

全球发言只是扩大了项目范围,使项目设计书能够“看到否则会隐藏的物品”。 尽管范围的互动并不总是显而易见,但仍然需要了解可变的范围。 我建议重读优秀的购买力平价文件。 你或许需要几次阅读,并在点击之前试验一个比照。

你的法典问题是,除非你不展示的圈子内,否则你将永远不会看到美元的价值,因为如果说话是<branch,而且你只会执行一个部门,而不会超过1美元。

你的榜样的另一个问题是,如果发言的话,你会利用联系关系,这好像:

switch ($a) {
    case 1:
        $b = "ABC";
        break;
    case 2:
        # $b will ALWAYS be empty unless you set it BEFORE the switch OR
        # you loop back to the switch AFTER $a=1
        echo $b;
        break;
    default:
        echo "i is not equal to 1 or 2";
}

这种形式可以更清晰地阅读,而且更加简单;随着案件数目的增加,这种形式更为有力。

如果1美元=ABC,而它从来就没有,如果是2美元,那么它的价值就只能是1美元或2美元,或者如果是2美元,那么它就永远不会进入你的第一个条件,但你可以事先确定美元。

$b = "something";
if ($a == 1)
{
  $b = "ABC"; // $b is ABC if $a = 1
}
elseif ($a == 2)
{
 echo $b; // output : something, if $a  = 2
}
$b = Null
if ($a == 1)
{
  $b = "ABC";
}
elseif ($a == 2)
{
 echo $b;
}




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签