I have the following function:
function clean_form( &$from_check ) {
if(is_array($from_check)){
array_walk(&$from_check,'clean_form');
return;
} else {
$value = str_replace(array("\r","\n","Content-Type:"),"",$from_check);
}
When I call this function I get the following warning:
Warning: Call-time pass-by-reference has been deprecated - argument passed
by value; If you would like to pass it by reference, modify the declaration
of array_walk(). If you would like to enable call-time pass-by-reference,
you can set allow_call_time_pass_reference to true in your INI file.
However, future versions may not support this any longer.
In the PHP doc it shows referencing the array argument "by reference"; i.e.
'&' , but the runtime says this is a "no go". Then how am I supposed to use
array_walk?
TIA,
Larry Woods 2 2163
lwoods wrote: function clean_form( &$from_check ) { array_walk(&$from_check,'clean_form');
You need to define at least two parameters for the function you call with
array_walk: array and item. So try: function clean_form(&$from_check,
$value) { etc. }. That might take care of the error.
--
E. Dronkert
lwoods wrote: I have the following function:
function clean_form( &$from_check ) { if(is_array($from_check)){ array_walk(&$from_check,'clean_form'); return; } else { $value = str_replace(array("\r","\n","Content-Type:"),"",$from_check); }
When I call this function I get the following warning:
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of array_walk(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer.
In the PHP doc it shows referencing the array argument "by reference"; i.e. '&' , but the runtime says this is a "no go". Then how am I supposed to use array_walk?
TIA,
array_walk() is declared to take a reference as the first argument, so
you don't need to use & when you call the function. Just do
array_walk($from_check,'clean_form').
The error message is bogus though. The array will still be passed by
reference in this instance. Report it as a bug. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Phil Powell |
last post by:
<?php
class Grad {
var $dbFormExemptionArray = array();
function Grad ($id = '') {
...
|
by: Reply-Via-Newsgroup |
last post by:
Folks,
I have a multi-dimensional array that I read from my mysql database. I'd
like to run strip slashes against each element and I'm pretty sure that
array_walk() (or array_map) is likely to...
|
by: steve |
last post by:
Hi, I have never used array_walk, and quite frankly, cannot see why I
should use it instead of foreach.
Can someone shed some light on the cases where array_walk is the one
to use, and what php...
|
by: David |
last post by:
Hi,
Could PHP be used to take a txt file (or set of txt files) and add a
string of characters every X number of words or characters?
Say a txt file with 50,000 characters/5,000 words how would...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |