Home Backend Development PHP Tutorial Strict Standards: Only variables should be passed by referen_PHP教程

Strict Standards: Only variables should be passed by referen_PHP教程

Jul 13, 2016 am 10:57 AM
only reference variables article

This article will introduce to you the solution to Strict Standards: Only variables should be passed by reference in. Friends can refer to it.

Use the built-in reset function in php to get the value of the first element of the array. For example:

//The output result is one. For the following code, if "Strict Standards" is turned on in PHP, you will see the prompt "Strict Standards: Only variables should be passed by reference in".
The code is as follows
 代码如下 复制代码

$arr = array('one', 'two', 'three');

echo reset($arr);  

Copy code

 代码如下 复制代码

$str = 'netingcn.com';

echo reset(explode('.', $str));

$arr = array('one', 'two', 'three');

echo reset($arr);

The code is as follows
Copy code

$str = 'netingcn.com';echo reset(explode('.', $str)); Why is this happening? You can first take a look at the definition of the reset function: function reset (array &$array) {}As you can see from the definition, the parameter accepted by reset is a reference to an array. The return value of explode in the above code is not a reference to any array, so there will be the above prompt under "Strict Standards". The solution is very simple, just write reset(explode('.', $str)) in two steps. The first step is to assign the return value of explode to a variable, and the second step is to use this variable as the reset parameter. The above prompt is not just for the reset function. As long as the parameter accepts an object reference and the function return value is used directly to pass the value, you will see such a prompt. For example, built-in array_pop, shuffle, curent, next, prev, next, etc.
http://www.bkjia.com/PHPjc/632075.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632075.htmlTechArticleThis article will introduce to you the solution to Strict Standards: Only variables should be passed by reference in. Friends can refer to it. . Use the built-in reset function in php to get the array...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How can I make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! How can I make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! Mar 15, 2024 pm 04:13 PM

1. How can you make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! 1. Activate basic rights and interests: original articles can earn profits by advertising, and videos must be original in horizontal screen mode to earn profits. 2. Activate the rights of 100 fans: if the number of fans reaches 100 fans or above, you can get profits from micro headlines, original Q&A creation and Q&A. 3. Insist on original works: Original works include articles, micro headlines, questions, etc., and are required to be more than 300 words. Please note that if illegally plagiarized works are published as original works, credit points will be deducted, and even any profits will be deducted. 4. Verticality: When writing articles in professional fields, you cannot write articles across fields at will. You will not get appropriate recommendations, you will not be able to achieve the professionalism and refinement of your work, and it will be difficult to attract fans and readers. 5. Activity: high activity,

Solution to PHP Notice: Only variables should be passed by reference in Solution to PHP Notice: Only variables should be passed by reference in Jun 22, 2023 pm 09:04 PM

PHP is a commonly used server-side scripting language, so when developing a website, PHPNotice error messages are very common. Among them, "PHPNotice:Onlyvariablesshouldbepassedbyreferencein" is a common error message. What this error message means is: only variables should be passed by reference. We know that in a function or method, variables can be called by passing parameters, so that in the code

How to add article in HTML5? How to add article in HTML5? Sep 12, 2023 am 11:37 AM

In this article, we will learn how to add articles in HTML5. One of the new segmentation elements in HTML5 is the tag. Articles are represented in HTML using tags. More specifically, the content contained within the element is different from the rest of the site's content (even though they may be related). Let us consider the following example to understand how to add an article in HTML5 Example 1 In the following example, we are using inline styles in the article element. <!DOCTYPEhtml><html><body><articlestyle="width:300px;border:2pxsolidgray;padding:

Interpretation of Vitalik's new article: Why does Rollup, whose blob space is not used efficiently, fall into development difficulties? Interpretation of Vitalik's new article: Why does Rollup, whose blob space is not used efficiently, fall into development difficulties? Apr 01, 2024 pm 08:16 PM

How to understand @VitalikButerin’s new article’s thoughts on Ethereum’s expansion? Some people say that Vitalik’s order for Blob Inscription is outrageous. So how do blob packets work? Why is the blob space not being used efficiently after the upgrade in Cancun? DAS data availability sampling in preparation for sharding? In my opinion, the performance of Cancun is usable after the upgrade, and Vitalik is worried about the development of Rollup. Why? Next, let me talk about my understanding: As I have explained many times before, Blob is a temporary data package that is decoupled from EVM calldata and can be directly called by the consensus layer. The direct benefit is that EVM does not need to access the Blob when executing transactions. data, thus resulting in lower execution layer computations

Detailed method for sending articles and recordings at the same time via WeChat Detailed method for sending articles and recordings at the same time via WeChat Mar 26, 2024 am 09:16 AM

1. Open your phone, click on the WeChat software, and enter the WeChat home page settings. 2. Find [My] in the lower right corner of WeChat, open it, and enter the [My] page. 3. Click Collection and then open a new page.

What should I do if the content of Dreamweaver CMS articles disappears? Quick solution What should I do if the content of Dreamweaver CMS articles disappears? Quick solution Mar 29, 2024 am 11:36 AM

DedeCMS is a powerful open source content management system that is widely used in various website construction. However, sometimes article content may disappear during use, which causes trouble to website operators. This article will introduce to you the common reasons and quick solutions for the disappearance of article content in DreamWeaver CMS, and provide specific code examples, hoping to help you solve this problem. 1. Possible reasons for the disappearance of article content: database operation error: the table storing article content in the database may

Is the content of DreamWeaver CMS articles lost? Done in one move Is the content of DreamWeaver CMS articles lost? Done in one move Mar 29, 2024 am 09:06 AM

DedeCMS is a powerful open source website content management system that is deeply loved by the majority of website builders. However, during use, article content may sometimes be lost, which causes considerable trouble to website administrators. This article will introduce a method to solve the problem of missing article content in DreamWeaver CMS, and provide specific code examples, hoping to help website administrators who encounter this problem. Description of the problem: In the process of using Dreamweaver CMS, sometimes the content of articles is lost. possible

Is it profitable to publish articles on Toutiao Search Express Edition? Is it profitable to publish articles on Toutiao Search Express Edition? Feb 29, 2024 pm 04:16 PM

Toutiao Search Express software not only provides a wealth of article content for users to browse, but also provides a platform for users to express themselves and share knowledge. Many users would like to know whether publishing articles in Toutiao Search Express Edition can make money, so today the editor of this site will introduce in detail whether publishing articles in Toutiao Search Express Edition can make money and how to publish articles. I hope it can help everyone in need. Is there any profit from publishing articles on Toutiao Search Express? Answer: Yes. 1. First, we open the Toutiao search speed version software. On the homepage, we click the [plus icon] in the upper right corner; 2. Then we will come to the page for publishing articles, where we can upload videos, photos, links, and enter text. Wait, everything is set up

See all articles