开发者

Php:Return a String from a function [closed]

开发者 https://www.devze.com 2023-03-22 13:13 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist

Closed 9 years ago.

Improve this question

The simple program is not returning the string,Please help.

<?php 
function returnStr开发者_JAVA技巧() {
return "fooBar";
}
$str=returnStr();
echo $str;
}
?> 


It's a parse error:

$str=returnStr();
echo $str;
}                   // WHAT IS THIS BRACKET DOING HERE?


There's a fatal error tokenizing the code due the trailing/unmatched '}' remove that and the code will work. Then spend some time thinking about why you didn't know this already


There's an error in your code. The last } is useless.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号