In "go" straight out of ASM or any other assembly language. Here's a link: I'd like to know: what can I do to make my code more efficient and how can I work on this larger project without snapping it up. Since goto statements allow you to jump back and forth and accidentally wait in an infinite loop if something happens the wrong way. Can you give me an example of this? EDIT: Well, I've seen the responses on CodeGo.net, and apparently there is widespread concern about "GOTO" and that it is bad. So I've been wondering: why is PHP's troublesome adding it to the language. If they don't see it inside, they won't do it...why? Also: A general comment about "go to" here in the StackOverflow EDIT2: Seeing as this question caused a lot of bad things it made me sad to go and ask my dad about the jump. He is 52 years old and an engineer. He did a good amount of programming in FORTRAN and COBOL during his days, mostly in FORTRAN and COBOL. Now he does IT services, servers and the like. Anyway, he said those things about "back in my day..." After a moment after that, he went back to saying that even back in his days as a student, they were shocked to know that this wasn't A clever idea, but they had no better idea of the situation. TRY/CATCH is still a few years old and Error handling is almost existed. So what are your procedures for checking that you did? Add a few lines at the end that give you the printout and everything you need to check your code, and then you put the lines: "go to print;", or similar, to start the printing of your data. And in this way, you slowly debug your code. He agrees that going into the modern programming world what he finds reasonable is an "emergency interrupt" in debugging and unexpected situations. Sort of like goto fatal_error; and does something for the "is fatal_error" part of your code, showing you the in-depth results. But only if you create the final product there should be no jumps - Late edit: Another way to go about "go" in PHP5.3/PHP6
1. If you are writing good PHP Code , you should not need to jump. I think it's a bug they're adding it in because it just leads to lazy programming. See for a good one on adding this to PHP, and here's Stack Overflow,
2. I've only found out about goto: typing out nested loops. But most new languages have to do this without goto anyway (break
3. Is there such a thing as a jump. Maybe, just maybe, it's possible to get out of multiple nested loops, but you can already do "break 2" like this. Tags in Java also serve this purpose better than go. Maybe it's an exception with code writing when you need to jump to the end of a bunch at a time where one of them fails. But that just fixes crappy code to even crappier code.
4. It can be used for debugging purposes so you don't have to break out or refactor blocks of code just to temporarily change the worker threads.
5. In classic VB coding, using goto is very convenient for simulating try/catch error handling like this:
Function MyFunction() as String '-- start of error block ' On Error Goto Catch ' do something here that might cause an error MyFunction = "IT WORKED" Exit Function Catch: ' error occured - do something else MyFunction = Err.Description ' '-- end of error block End Function ...这里是一种模拟的try / catch /终于..Function MyFunction() as String '-- start of error block ' On Error Goto Catch ' do something here that might cause an error MyFunction = "IT WORKED" Goto Finally Catch: ' error occured - do something else MyFunction = Err.Description Err.Clear Finally: ' put your finally code here ' '-- end of error block End Function
It can also be used to clear at the end of a function, although I Thinking you could make another function that could be called to do this in case of cleanup. To be honest, I had never been in PHP and I thought to myself: "Well, I wish there could be a goto. I didn't read up on why they decided to do this, but, those guys are very smart and had the opportunity to consider PHP Very good direction so far, so maybe there's a need for that, we don't know yet.
6. The thing I see about using goto is the cross-language port I wrote in C. The language 's parser Generator generates a parser with goto statements (it's easier to use goto than more sane control structures), and porting it to PHP is now less of a headache ##. #7. When writing finite state machines, you do need one of them when the parsing context is released, although we can live without a jump if
continue $case; is in a switch block. Efficiently jumping to a different situation and closing the scope is achievable in as many languages as there are nowadays. Until then, we were pretty much stuck with goto 8. Jumps can help reduce code duplication in stack unwinding. Pseudocode below:
do A if (error) goto out_a; do B if (error) goto out_b; do C if (error) goto out_c; goto out; out_c: undo C out_b: undo B: out_a: undo A out: return ret;
(伪由罗伯特爱,从linux内核归档的邮件列表采取代码:)
9. 由于之前已经说过,GOTO是唯一真正需要的类型的算法,通常是那些在语言解析或有限状态机。我从来没有错过在PHP缺乏goto语句。 OTOH,我有一个语言,其中只有两个结构是函数和条件goto方法:SNOBOL4。由于意大利面条代码的风险是如此之高,最SNOBOL4是/很小心的避免这一点。但是goto语句也使很紧的编程,创意循环执行等。它实际上是更容易做到的FSM型圈,如果你有在使用goto。
10. 我承认我转到我的代码。 :) 唯一的理由似乎有利于在最短的flyway从其他语言到PHP(实际上只改变语言不碰控制结构)和重构代码的移植的第2阶段。 我个人认为和同事,因为他们可以避开有条件决裂-S的循环,他们将能够抵御转到诱惑。
11. 生成的代码可以使goto语句,我猜。对生成的代码的好处是,你并不需要去维护它-你只是重新生成它。
12. goto真正应该尽管这是在语言,并会进行过时由于更好的编程实践。现在添加它似乎是一个倒退的一步。
13. goto语句中的B大优势就是学习曲线。人们不禁要问,为什么像visualstudia和Mac电脑的工具做的很好。原因是,人们需要的不仅仅是一个伟大的产品,他们希望有一个 伟大的产品,他们可以在短短一个小时左右学习。现在很多 一个天只计划为他们的工作之一。我看到这么多的书说,一个人永远不能 使用goto语句,然后给五年左右的技术,例如,他们说每消除 需要它。我说,只是事实,5是该有多好转到证明 是!!我没有教的五件事,包括异常结构, 把整个章节来解释!!当你真正需要的是一个简单的跳转 可在30秒内进行解释。当然,你可以创建恶意代码与他们如果 希望---但是,嘿,最不想写糟糕的代码,如果他们 他们才可以呢。最goto语句在我们的实验室所做的代码简单 了解和学习;程度远远超过了读一本2000页的书。
The above is the detailed content of Detailed explanation of the goto statement added in PHP5.3. For more information, please follow other related articles on the PHP Chinese website!

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor
