Appel à une fonction non définie create_function.

Résolu/Fermé
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024 - 16 oct. 2021 à 10:36
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024 - 16 oct. 2021 à 18:04
Bonjour,

Toujours dans la cadre de la migration à PHP 8, un nouveau message d'erreur apparait ligne 44 concernant un autre fichier que voici:



Voici le fichier dans son intégralité:
<?php

/**
 *		ARRAY FUNCTIONS
 * * * * * * * * * * * * * * * * * * * * * * * * * * */


/** function array_trim [arrayTrim]
 *		Performs the trim function recursively on
 *		every element in an array and optionally typecasts
 *		the element to the given type
 *
 * @param mixed csv list or array by reference
 * @param string optional typecast type
 * @return array
 */
function array_trim( & $array, $type = null)
{
	$types = array(
		'int' , 'integer' ,
		'bool' , 'boolean' ,
		'float' , 'double' , 'real' ,
		'string' ,
		'array' ,
		'object' ,
	);

	// if a non-empty string value comes through, don't erase it
	// this is specifically for '0', but may work for others
	$is_non_empty_string = (is_string($array) && strlen(trim($array)));
	if ( ! $array && ! $is_non_empty_string) {
		$array = array( );
	}

	if ( ! in_array($type, $types)) {
		$type = null;
	}

	if ( ! is_array($array)) {
		$array = explode(',', $array);
	}

	if ( ! is_null($type)) {
		array_walk_recursive($array, create_function('&$v', '$v = ('.$type.') trim($v);'));
	}
	else {
		array_walk_recursive($array, create_function('&$v', '$v = trim($v);'));
	}

	return $array; // returns by reference as well
}
function arrayTrim( & $array, $type = null) { return array_trim($array, $type); }


/** function array_clean [arrayClean]
 *		Strips out the unnecessary bits from an array
 *		so it can be input into a database, or to just
 *		generally clean an array of fluff
 *
 * @param array data array to be cleaned
 * @param mixed csv or array of allowed keys
 * @param mixed optional csv or array of required keys
 * @return array
 */
function array_clean($array, $keys, $reqd = array( ))
{
	if ( ! is_array($array)) {
		return array( );
	}

	array_trim($keys);
	array_trim($reqd);

	$keys = array_unique(array_merge($keys, $reqd));

	if (empty($keys)) {
		return array( );
	}

	$return = array( );
	foreach ($keys as $key) {
		if (in_array($key, $reqd) && (empty($array[$key]))) {
			throw new Exception(__FUNCTION__.': L\'élement requis ('.$key.') est manquant');
		}

		if (isset($array[$key])) {
			$return[$key] = $array[$key];
		}
	}

	return $return;
}
function arrayClean($array, $keys, $reqd = array( )) { return array_clean($array, $keys, $reqd); }


/** function array_transpose [arrayTranspose]
 *		Transposes a 2-D array
 *		array[i][j] becomes array[j][i]
 *
 *		Not to be confused with the PHP function array_flip
 *
 * @param array
 * @return mixed array (or bool false on failure)
 */
function array_transpose($array)
{
	if ( ! is_array($array)) {
		throw new Exception(__FUNCTION__.': Les données ne constituaient pas un array');
	}

	$return = array( );
	foreach ($array as $key1 => $value1) {
		if ( ! is_array($value1)) {
			continue;
		}

		foreach ($value1 as $key2 => $value2) {
			$return[$key2][$key1] = $value2;
		}
	}

	if (0 == count($return)) {
		return false;
	}

	return $return;
}
function arrayTranspose($array) { return array_transpose($array); }


/** function array_shrink [arrayShrink]
 *		Returns all elements with second level key $key
 *		from a 2-D array
 *		e.g.-
 *			$array[0]['foo'] = 'bar';
 *			$array[1]['foo'] = 'baz';
 *
 *		array_shrink($array, 'foo') returns
 *			array(
 *				[0] = 'bar'
 *				[1] = 'baz'
 *			)
 *
 *		This function returns the input if it is not
 *		an array, or returns false if the key is not
 *		present in the array
 *
 * @param array data array
 * @param mixed second level key
 * @return mixed array (or original input or bool false on failure)
 */
function array_shrink($array, $key)
{
	if ( ! is_array($array)) {
		return $array;
	}

	$array = array_transpose($array);

	if ( ! isset($array[$key])) {
		return false;
	}

	return $array[$key];
}
function arrayShrink($array, $key) { return array_shrink($array, $key); }


/** function array_sum_field [arraySumField]
 *		Returns the sum of all elements with key $key
 *		from a 2-D array, no matter if $key is a first level
 *		or second level key
 *
 * @param array
 * @param mixed element key
 * @return mixed float/int total (or bool false on failure)
 */
function array_sum_field($array, $key)
{
	if ( ! is_array($array)) {
		return false;
	}

	$total = 0;

	if (isset($array[$key]) && is_array($array[$key])) {
		$total = array_sum($array[$key]);
	}
	else {
		foreach ($array as $row) {
			if (is_array($row) && isset($row[$key])) {
				$total += $row[$key];
			}
		}
	}

	return $total;
}
function arraySumField($array, $key) { return array_sum_field($array, $key); }


/** function implode_full [implodeFull]
 *		Much like implode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create URL GET strings from arrays
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param array
 * @param bool optional URL encode flag
 * @return string
 */
function implode_full($separator, $divider, $array, $url = false)
{
	if ( ! is_array($array) || (0 == count($array))) {
		return $array;
	}

	$str = '';
	foreach ($array as $key => $val) {
		$str .= $key.$divider.$val.$separator;
	}

	$str = substr($str, 0, -(strlen($separator)));

	if ($url) {
		$str = url_encode($str);
	}

	return $str;
}
function implodeFull($separator, $divider, $array, $url = false) { return implode_full($separator, $divider, $array, $url); }


/** function explode_full [explodeFull]
 *		Much like explode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create arrays from URL GET strings
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param string
 * @param bool optional URL encode flag
 * @return array
 */
function explode_full($separator, $divider, $string, $url = false)
{
	// explode the string about the separator
	$first = explode($separator, $string);

	// now go through each element in the first array and explode each about the divider
	foreach ($first as $element) {
		list($key, $value) = explode($divider, $element);
		$array[$key] = $value;
	}

	return $array;
}
function explodeFull($separator, $divider, $string, $url = false) { return explode_full($separator, $divider, $string, $url); }


/** function kshuffle
 *		Exactly the same as shuffle except this function
 *		preserves the original keys of the array
 *
 * @param array the array to shuffle by reference
 * @return array
 */
function kshuffle( & $array)
{
	uasort($array, create_function('$a,$b', 'rand(1, -1);'));
}


/** function array_merge_plus
 *		Exactly the same as array_merge except this function
 *		allows entry of non-arrays without throwing errors
 *		If an empty argument is encountered, it removes it.
 *		If a non-empty, non-array value is encountered,
 *		it appends it to the array in the order received.
 *
 * @param mixed item to merge into array
 * @param ...
 * @return array merged array
 */
function array_merge_plus($array1) {
	// grab the arguments of this function
	// and parse through them, removing any empty arguments
	// and converting non-empty, non-arrays to arrays
	$args = func_get_args( );
	foreach ($args as $key => $arg) {
		if ( ! is_array($arg)) {
			if (empty($arg)) {
				unset($args[$key]);
				continue;
			}
		}

		$args[$key] = (array) $arg;
	}

	// generate an eval string to pass the clean arguments to array_merge
	$eval_string = '$return = array_merge(';
	foreach ($args as $key => $null) {
		$eval_string .= '$args['.$key.'],';
	}
	$eval_string = substr($eval_string, 0, -1).');';

	$return = false;
	eval($eval_string);

	return $return;
}


function array_compare($array1, $array2) {
	$diff = array(array( ), array( ));

	// Left-to-right
	foreach ($array1 as $key => $value) {
		if ( ! array_key_exists($key, $array2)) {
			$diff[0][$key] = $value;
		}
		elseif (is_array($value)) {
			if ( ! is_array($array2[$key])) {
				$diff[0][$key] = $value;
				$diff[1][$key] = $array2[$key];
			}
			else {
				$new = array_compare($value, $array2[$key]);
				if ($new !== false) {
					if (isset($new[0])) {
						$diff[0][$key] = $new[0];
					}

					if (isset($new[1])) {
						$diff[1][$key] = $new[1];
					}
				}
			}
		}
		elseif ($array2[$key] !== $value) {
			$diff[0][$key] = $value;
			$diff[1][$key] = $array2[$key];
		}
	}

	// Right-to-left
	foreach ($array2 as $key => $value) {
		if ( ! array_key_exists($key, $array1)) {
			$diff[1][$key] = $value;
		}
		// No direct comparison because matching keys were compared in the
		// left-to-right loop earlier, recursively.
	}

	return $diff;
}


Pourriez vous me venir en aide pour résoudre ce problème?
Merci.



Configuration: Windows / Firefox 93.0
A voir également:

5 réponses

jordane45 Messages postés 38140 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 20 avril 2024 4 649
16 oct. 2021 à 10:45
Bonjour,

Le message semble plutot clair....
Et si tu prends deux secondes pour rechercher ce que c'est sur internet, tu verras qu'en effet, dans la documentation de php il est indiqué que cette fonction n'existe plus en php8
https://www.php.net/manual/fr/function.create-function.php

et en cherchant deux secondes de plus, tu aurais pu trouver un article du genre
https://lindevs.com/function-create_function-has-been-removed-in-php-8-0/


et donc.. tu dois pouvoir réécrire le code en utilisant une fonction anonyme à la place
un truc du genre
 array_walk_recursive($array, function('&$v'){
       return '$v = ('.$type.') trim($v);'}
    );


il te faudra faire la même opération pour tes lignes : 41 et 271
0
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024
16 oct. 2021 à 10:48
Je pense avoir trouvé la solution en supprimant les lignes 43 à 48 comme ci dessous:
<?php

/**
 *		ARRAY FUNCTIONS
 * * * * * * * * * * * * * * * * * * * * * * * * * * */


/** function array_trim [arrayTrim]
 *		Performs the trim function recursively on
 *		every element in an array and optionally typecasts
 *		the element to the given type
 *
 * @param mixed csv list or array by reference
 * @param string optional typecast type
 * @return array
 */
function array_trim( & $array, $type = null)
{
	$types = array(
		'int' , 'integer' ,
		'bool' , 'boolean' ,
		'float' , 'double' , 'real' ,
		'string' ,
		'array' ,
		'object' ,
	);

	// if a non-empty string value comes through, don't erase it
	// this is specifically for '0', but may work for others
	$is_non_empty_string = (is_string($array) && strlen(trim($array)));
	if ( ! $array && ! $is_non_empty_string) {
		$array = array( );
	}

	if ( ! in_array($type, $types)) {
		$type = null;
	}

	if ( ! is_array($array)) {
		$array = explode(',', $array);
	}

	/*if ( ! is_null($type)) {
		array_walk_recursive($array, create_function('&$v', '$v = ('.$type.') trim($v);'));
	}
	else {
		array_walk_recursive($array, create_function('&$v', '$v = trim($v);'));
	}*/

	return $array; // returns by reference as well
}
function arrayTrim( & $array, $type = null) { return array_trim($array, $type); }


/** function array_clean [arrayClean]
 *		Strips out the unnecessary bits from an array
 *		so it can be input into a database, or to just
 *		generally clean an array of fluff
 *
 * @param array data array to be cleaned
 * @param mixed csv or array of allowed keys
 * @param mixed optional csv or array of required keys
 * @return array
 */
function array_clean($array, $keys, $reqd = array( ))
{
	if ( ! is_array($array)) {
		return array( );
	}

	array_trim($keys);
	array_trim($reqd);

	$keys = array_unique(array_merge($keys, $reqd));

	if (empty($keys)) {
		return array( );
	}

	$return = array( );
	foreach ($keys as $key) {
		if (in_array($key, $reqd) && (empty($array[$key]))) {
			throw new Exception(__FUNCTION__.': L\'élement requis ('.$key.') est manquant');
		}

		if (isset($array[$key])) {
			$return[$key] = $array[$key];
		}
	}

	return $return;
}
function arrayClean($array, $keys, $reqd = array( )) { return array_clean($array, $keys, $reqd); }


/** function array_transpose [arrayTranspose]
 *		Transposes a 2-D array
 *		array[i][j] becomes array[j][i]
 *
 *		Not to be confused with the PHP function array_flip
 *
 * @param array
 * @return mixed array (or bool false on failure)
 */
function array_transpose($array)
{
	if ( ! is_array($array)) {
		throw new Exception(__FUNCTION__.': Les données ne constituaient pas un array');
	}

	$return = array( );
	foreach ($array as $key1 => $value1) {
		if ( ! is_array($value1)) {
			continue;
		}

		foreach ($value1 as $key2 => $value2) {
			$return[$key2][$key1] = $value2;
		}
	}

	if (0 == count($return)) {
		return false;
	}

	return $return;
}
function arrayTranspose($array) { return array_transpose($array); }


/** function array_shrink [arrayShrink]
 *		Returns all elements with second level key $key
 *		from a 2-D array
 *		e.g.-
 *			$array[0]['foo'] = 'bar';
 *			$array[1]['foo'] = 'baz';
 *
 *		array_shrink($array, 'foo') returns
 *			array(
 *				[0] = 'bar'
 *				[1] = 'baz'
 *			)
 *
 *		This function returns the input if it is not
 *		an array, or returns false if the key is not
 *		present in the array
 *
 * @param array data array
 * @param mixed second level key
 * @return mixed array (or original input or bool false on failure)
 */
function array_shrink($array, $key)
{
	if ( ! is_array($array)) {
		return $array;
	}

	$array = array_transpose($array);

	if ( ! isset($array[$key])) {
		return false;
	}

	return $array[$key];
}
function arrayShrink($array, $key) { return array_shrink($array, $key); }


/** function array_sum_field [arraySumField]
 *		Returns the sum of all elements with key $key
 *		from a 2-D array, no matter if $key is a first level
 *		or second level key
 *
 * @param array
 * @param mixed element key
 * @return mixed float/int total (or bool false on failure)
 */
function array_sum_field($array, $key)
{
	if ( ! is_array($array)) {
		return false;
	}

	$total = 0;

	if (isset($array[$key]) && is_array($array[$key])) {
		$total = array_sum($array[$key]);
	}
	else {
		foreach ($array as $row) {
			if (is_array($row) && isset($row[$key])) {
				$total += $row[$key];
			}
		}
	}

	return $total;
}
function arraySumField($array, $key) { return array_sum_field($array, $key); }


/** function implode_full [implodeFull]
 *		Much like implode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create URL GET strings from arrays
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param array
 * @param bool optional URL encode flag
 * @return string
 */
function implode_full($separator, $divider, $array, $url = false)
{
	if ( ! is_array($array) || (0 == count($array))) {
		return $array;
	}

	$str = '';
	foreach ($array as $key => $val) {
		$str .= $key.$divider.$val.$separator;
	}

	$str = substr($str, 0, -(strlen($separator)));

	if ($url) {
		$str = url_encode($str);
	}

	return $str;
}
function implodeFull($separator, $divider, $array, $url = false) { return implode_full($separator, $divider, $array, $url); }


/** function explode_full [explodeFull]
 *		Much like explode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create arrays from URL GET strings
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param string
 * @param bool optional URL encode flag
 * @return array
 */
function explode_full($separator, $divider, $string, $url = false)
{
	// explode the string about the separator
	$first = explode($separator, $string);

	// now go through each element in the first array and explode each about the divider
	foreach ($first as $element) {
		list($key, $value) = explode($divider, $element);
		$array[$key] = $value;
	}

	return $array;
}
function explodeFull($separator, $divider, $string, $url = false) { return explode_full($separator, $divider, $string, $url); }


/** function kshuffle
 *		Exactly the same as shuffle except this function
 *		preserves the original keys of the array
 *
 * @param array the array to shuffle by reference
 * @return array
 */
function kshuffle( & $array)
{
	uasort($array, create_function('$a,$b', 'rand(1, -1);'));
}


/** function array_merge_plus
 *		Exactly the same as array_merge except this function
 *		allows entry of non-arrays without throwing errors
 *		If an empty argument is encountered, it removes it.
 *		If a non-empty, non-array value is encountered,
 *		it appends it to the array in the order received.
 *
 * @param mixed item to merge into array
 * @param ...
 * @return array merged array
 */
function array_merge_plus($array1) {
	// grab the arguments of this function
	// and parse through them, removing any empty arguments
	// and converting non-empty, non-arrays to arrays
	$args = func_get_args( );
	foreach ($args as $key => $arg) {
		if ( ! is_array($arg)) {
			if (empty($arg)) {
				unset($args[$key]);
				continue;
			}
		}

		$args[$key] = (array) $arg;
	}

	// generate an eval string to pass the clean arguments to array_merge
	$eval_string = '$return = array_merge(';
	foreach ($args as $key => $null) {
		$eval_string .= '$args['.$key.'],';
	}
	$eval_string = substr($eval_string, 0, -1).');';

	$return = false;
	eval($eval_string);

	return $return;
}


function array_compare($array1, $array2) {
	$diff = array(array( ), array( ));

	// Left-to-right
	foreach ($array1 as $key => $value) {
		if ( ! array_key_exists($key, $array2)) {
			$diff[0][$key] = $value;
		}
		elseif (is_array($value)) {
			if ( ! is_array($array2[$key])) {
				$diff[0][$key] = $value;
				$diff[1][$key] = $array2[$key];
			}
			else {
				$new = array_compare($value, $array2[$key]);
				if ($new !== false) {
					if (isset($new[0])) {
						$diff[0][$key] = $new[0];
					}

					if (isset($new[1])) {
						$diff[1][$key] = $new[1];
					}
				}
			}
		}
		elseif ($array2[$key] !== $value) {
			$diff[0][$key] = $value;
			$diff[1][$key] = $array2[$key];
		}
	}

	// Right-to-left
	foreach ($array2 as $key => $value) {
		if ( ! array_key_exists($key, $array1)) {
			$diff[1][$key] = $value;
		}
		// No direct comparison because matching keys were compared in the
		// left-to-right loop earlier, recursively.
	}

	return $diff;
}


Est ce correct?
0
jordane45 Messages postés 38140 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 20 avril 2024 4 649
16 oct. 2021 à 10:49
non...
Tu n'as pas "corrigé" ...
Tu as juste supprimé les lignes qui te posaient problème.. sans te souci de ce à quoi elles servent ...

En gros... tu as mal à la main.. donc tu coupes le bras... et puis.. c'est bon.. tu n'as plus mal à la main...
0
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024 > jordane45 Messages postés 38140 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 20 avril 2024
16 oct. 2021 à 11:25
J'ai compris.
0
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024
16 oct. 2021 à 11:22
J'ai modifié les lignes comme ci dessous:
<?php

/**
 *		ARRAY FUNCTIONS
 * * * * * * * * * * * * * * * * * * * * * * * * * * */


/** function array_trim [arrayTrim]
 *		Performs the trim function recursively on
 *		every element in an array and optionally typecasts
 *		the element to the given type
 *
 * @param mixed csv list or array by reference
 * @param string optional typecast type
 * @return array
 */
function array_trim( & $array, $type = null)
{
	$types = array(
		'int' , 'integer' ,
		'bool' , 'boolean' ,
		'float' , 'double' , 'real' ,
		'string' ,
		'array' ,
		'object' ,
	);

	// if a non-empty string value comes through, don't erase it
	// this is specifically for '0', but may work for others
	$is_non_empty_string = (is_string($array) && strlen(trim($array)));
	if ( ! $array && ! $is_non_empty_string) {
		$array = array( );
	}

	if ( ! in_array($type, $types)) {
		$type = null;
	}

	if ( ! is_array($array)) {
		$array = explode(',', $array);
	}

	/*if ( ! is_null($type)) {
		array_walk_recursive($array, create_function('&$v', '$v = ('.$type.') trim($v);'));
	}*/
	if ( ! is_null($type)) {
		array_walk_recursive($array, function('&$v'){
       return '$v = ('.$type.') trim($v);'}
    );
	}
		
	/*else {
		array_walk_recursive($array, create_function('&$v', '$v = trim($v);'));
	}*/

	return $array; // returns by reference as well
}
function arrayTrim( & $array, $type = null) { return array_trim($array, $type); }


/** function array_clean [arrayClean]
 *		Strips out the unnecessary bits from an array
 *		so it can be input into a database, or to just
 *		generally clean an array of fluff
 *
 * @param array data array to be cleaned
 * @param mixed csv or array of allowed keys
 * @param mixed optional csv or array of required keys
 * @return array
 */
function array_clean($array, $keys, $reqd = array( ))
{
	if ( ! is_array($array)) {
		return array( );
	}

	array_trim($keys);
	array_trim($reqd);

	$keys = array_unique(array_merge($keys, $reqd));

	if (empty($keys)) {
		return array( );
	}

	$return = array( );
	foreach ($keys as $key) {
		if (in_array($key, $reqd) && (empty($array[$key]))) {
			throw new Exception(__FUNCTION__.': L\'élement requis ('.$key.') est manquant');
		}

		if (isset($array[$key])) {
			$return[$key] = $array[$key];
		}
	}

	return $return;
}
function arrayClean($array, $keys, $reqd = array( )) { return array_clean($array, $keys, $reqd); }


/** function array_transpose [arrayTranspose]
 *		Transposes a 2-D array
 *		array[i][j] becomes array[j][i]
 *
 *		Not to be confused with the PHP function array_flip
 *
 * @param array
 * @return mixed array (or bool false on failure)
 */
function array_transpose($array)
{
	if ( ! is_array($array)) {
		throw new Exception(__FUNCTION__.': Les données ne constituaient pas un array');
	}

	$return = array( );
	foreach ($array as $key1 => $value1) {
		if ( ! is_array($value1)) {
			continue;
		}

		foreach ($value1 as $key2 => $value2) {
			$return[$key2][$key1] = $value2;
		}
	}

	if (0 == count($return)) {
		return false;
	}

	return $return;
}
function arrayTranspose($array) { return array_transpose($array); }


/** function array_shrink [arrayShrink]
 *		Returns all elements with second level key $key
 *		from a 2-D array
 *		e.g.-
 *			$array[0]['foo'] = 'bar';
 *			$array[1]['foo'] = 'baz';
 *
 *		array_shrink($array, 'foo') returns
 *			array(
 *				[0] = 'bar'
 *				[1] = 'baz'
 *			)
 *
 *		This function returns the input if it is not
 *		an array, or returns false if the key is not
 *		present in the array
 *
 * @param array data array
 * @param mixed second level key
 * @return mixed array (or original input or bool false on failure)
 */
function array_shrink($array, $key)
{
	if ( ! is_array($array)) {
		return $array;
	}

	$array = array_transpose($array);

	if ( ! isset($array[$key])) {
		return false;
	}

	return $array[$key];
}
function arrayShrink($array, $key) { return array_shrink($array, $key); }


/** function array_sum_field [arraySumField]
 *		Returns the sum of all elements with key $key
 *		from a 2-D array, no matter if $key is a first level
 *		or second level key
 *
 * @param array
 * @param mixed element key
 * @return mixed float/int total (or bool false on failure)
 */
function array_sum_field($array, $key)
{
	if ( ! is_array($array)) {
		return false;
	}

	$total = 0;

	if (isset($array[$key]) && is_array($array[$key])) {
		$total = array_sum($array[$key]);
	}
	else {
		foreach ($array as $row) {
			if (is_array($row) && isset($row[$key])) {
				$total += $row[$key];
			}
		}
	}

	return $total;
}
function arraySumField($array, $key) { return array_sum_field($array, $key); }


/** function implode_full [implodeFull]
 *		Much like implode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create URL GET strings from arrays
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param array
 * @param bool optional URL encode flag
 * @return string
 */
function implode_full($separator, $divider, $array, $url = false)
{
	if ( ! is_array($array) || (0 == count($array))) {
		return $array;
	}

	$str = '';
	foreach ($array as $key => $val) {
		$str .= $key.$divider.$val.$separator;
	}

	$str = substr($str, 0, -(strlen($separator)));

	if ($url) {
		$str = url_encode($str);
	}

	return $str;
}
function implodeFull($separator, $divider, $array, $url = false) { return implode_full($separator, $divider, $array, $url); }


/** function explode_full [explodeFull]
 *		Much like explode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create arrays from URL GET strings
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param string
 * @param bool optional URL encode flag
 * @return array
 */
function explode_full($separator, $divider, $string, $url = false)
{
	// explode the string about the separator
	$first = explode($separator, $string);

	// now go through each element in the first array and explode each about the divider
	foreach ($first as $element) {
		list($key, $value) = explode($divider, $element);
		$array[$key] = $value;
	}

	return $array;
}
function explodeFull($separator, $divider, $string, $url = false) { return explode_full($separator, $divider, $string, $url); }


/** function kshuffle
 *		Exactly the same as shuffle except this function
 *		preserves the original keys of the array
 *
 * @param array the array to shuffle by reference
 * @return array
 */
function kshuffle( & $array)
{
	uasort($array, create_function('$a,$b', 'rand(1, -1);'));
}


/** function array_merge_plus
 *		Exactly the same as array_merge except this function
 *		allows entry of non-arrays without throwing errors
 *		If an empty argument is encountered, it removes it.
 *		If a non-empty, non-array value is encountered,
 *		it appends it to the array in the order received.
 *
 * @param mixed item to merge into array
 * @param ...
 * @return array merged array
 */
function array_merge_plus($array1) {
	// grab the arguments of this function
	// and parse through them, removing any empty arguments
	// and converting non-empty, non-arrays to arrays
	$args = func_get_args( );
	foreach ($args as $key => $arg) {
		if ( ! is_array($arg)) {
			if (empty($arg)) {
				unset($args[$key]);
				continue;
			}
		}

		$args[$key] = (array) $arg;
	}

	// generate an eval string to pass the clean arguments to array_merge
	$eval_string = '$return = array_merge(';
	foreach ($args as $key => $null) {
		$eval_string .= '$args['.$key.'],';
	}
	$eval_string = substr($eval_string, 0, -1).');';

	$return = false;
	eval($eval_string);

	return $return;
}


function array_compare($array1, $array2) {
	$diff = array(array( ), array( ));

	// Left-to-right
	foreach ($array1 as $key => $value) {
		if ( ! array_key_exists($key, $array2)) {
			$diff[0][$key] = $value;
		}
		elseif (is_array($value)) {
			if ( ! is_array($array2[$key])) {
				$diff[0][$key] = $value;
				$diff[1][$key] = $array2[$key];
			}
			else {
				$new = array_compare($value, $array2[$key]);
				if ($new !== false) {
					if (isset($new[0])) {
						$diff[0][$key] = $new[0];
					}

					if (isset($new[1])) {
						$diff[1][$key] = $new[1];
					}
				}
			}
		}
		elseif ($array2[$key] !== $value) {
			$diff[0][$key] = $value;
			$diff[1][$key] = $array2[$key];
		}
	}

	// Right-to-left
	foreach ($array2 as $key => $value) {
		if ( ! array_key_exists($key, $array1)) {
			$diff[1][$key] = $value;
		}
		// No direct comparison because matching keys were compared in the
		// left-to-right loop earlier, recursively.
	}

	return $diff;
}

Mais je reçois ce message d'erreur:


Comment résoudre cette erreur de syntaxe ligne 47 ?
0
jordane45 Messages postés 38140 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 20 avril 2024 4 649
16 oct. 2021 à 11:37
Oui pardon, il faut retirer les quotes
function('&$v')

A corriger par
function(&$v)



Petite question : Tu essayes de comprendre les messages d'erreur avant de venir poser tes questions sur le forum ... ou tu ne cherches même pas à comprendre et tu attends qu'on te donne la réponse .
Par ce.. dans un cas... tu essayes.. mais tu n'y arrives pas... dans l'autre... ben tu t'en fous complètement ( et ce n'est pas tellement la façon de voir de ce forum...)
0
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024 > jordane45 Messages postés 38140 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 20 avril 2024
Modifié le 16 oct. 2021 à 12:17
J'essaie de comprendre les messages d'erreur.
Mais je n'arrive pas à les résoudre seul.
Cela fait longtemps que j'ai compris la philosophie du forum et que je m'y conforme.
Fort heureusement pour moi, je parviens quand même parfois à trouver des solutions à certains messages d'erreur.
0
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024 > jordane45 Messages postés 38140 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 20 avril 2024
16 oct. 2021 à 12:14
Je viens de modifier la ligne 47 comme tu me l'indiques:
<?php

/**
 *		ARRAY FUNCTIONS
 * * * * * * * * * * * * * * * * * * * * * * * * * * */


/** function array_trim [arrayTrim]
 *		Performs the trim function recursively on
 *		every element in an array and optionally typecasts
 *		the element to the given type
 *
 * @param mixed csv list or array by reference
 * @param string optional typecast type
 * @return array
 */
function array_trim( & $array, $type = null)
{
	$types = array(
		'int' , 'integer' ,
		'bool' , 'boolean' ,
		'float' , 'double' , 'real' ,
		'string' ,
		'array' ,
		'object' ,
	);

	// if a non-empty string value comes through, don't erase it
	// this is specifically for '0', but may work for others
	$is_non_empty_string = (is_string($array) && strlen(trim($array)));
	if ( ! $array && ! $is_non_empty_string) {
		$array = array( );
	}

	if ( ! in_array($type, $types)) {
		$type = null;
	}

	if ( ! is_array($array)) {
		$array = explode(',', $array);
	}

	/*if ( ! is_null($type)) {
		array_walk_recursive($array, create_function('&$v', '$v = ('.$type.') trim($v);'));
	}*/
	if ( ! is_null($type)) {
		array_walk_recursive($array, function(&$v){
       return '$v = ('.$type.') trim($v);'}
	   );
	}
		
	/*else {
		array_walk_recursive($array, create_function('&$v', '$v = trim($v);'));
	}*/

	return $array; // returns by reference as well
}
function arrayTrim( & $array, $type = null) { return array_trim($array, $type); }


/** function array_clean [arrayClean]
 *		Strips out the unnecessary bits from an array
 *		so it can be input into a database, or to just
 *		generally clean an array of fluff
 *
 * @param array data array to be cleaned
 * @param mixed csv or array of allowed keys
 * @param mixed optional csv or array of required keys
 * @return array
 */
function array_clean($array, $keys, $reqd = array( ))
{
	if ( ! is_array($array)) {
		return array( );
	}

	array_trim($keys);
	array_trim($reqd);

	$keys = array_unique(array_merge($keys, $reqd));

	if (empty($keys)) {
		return array( );
	}

	$return = array( );
	foreach ($keys as $key) {
		if (in_array($key, $reqd) && (empty($array[$key]))) {
			throw new Exception(__FUNCTION__.': L\'élement requis ('.$key.') est manquant');
		}

		if (isset($array[$key])) {
			$return[$key] = $array[$key];
		}
	}

	return $return;
}
function arrayClean($array, $keys, $reqd = array( )) { return array_clean($array, $keys, $reqd); }


/** function array_transpose [arrayTranspose]
 *		Transposes a 2-D array
 *		array[i][j] becomes array[j][i]
 *
 *		Not to be confused with the PHP function array_flip
 *
 * @param array
 * @return mixed array (or bool false on failure)
 */
function array_transpose($array)
{
	if ( ! is_array($array)) {
		throw new Exception(__FUNCTION__.': Les données ne constituaient pas un array');
	}

	$return = array( );
	foreach ($array as $key1 => $value1) {
		if ( ! is_array($value1)) {
			continue;
		}

		foreach ($value1 as $key2 => $value2) {
			$return[$key2][$key1] = $value2;
		}
	}

	if (0 == count($return)) {
		return false;
	}

	return $return;
}
function arrayTranspose($array) { return array_transpose($array); }


/** function array_shrink [arrayShrink]
 *		Returns all elements with second level key $key
 *		from a 2-D array
 *		e.g.-
 *			$array[0]['foo'] = 'bar';
 *			$array[1]['foo'] = 'baz';
 *
 *		array_shrink($array, 'foo') returns
 *			array(
 *				[0] = 'bar'
 *				[1] = 'baz'
 *			)
 *
 *		This function returns the input if it is not
 *		an array, or returns false if the key is not
 *		present in the array
 *
 * @param array data array
 * @param mixed second level key
 * @return mixed array (or original input or bool false on failure)
 */
function array_shrink($array, $key)
{
	if ( ! is_array($array)) {
		return $array;
	}

	$array = array_transpose($array);

	if ( ! isset($array[$key])) {
		return false;
	}

	return $array[$key];
}
function arrayShrink($array, $key) { return array_shrink($array, $key); }


/** function array_sum_field [arraySumField]
 *		Returns the sum of all elements with key $key
 *		from a 2-D array, no matter if $key is a first level
 *		or second level key
 *
 * @param array
 * @param mixed element key
 * @return mixed float/int total (or bool false on failure)
 */
function array_sum_field($array, $key)
{
	if ( ! is_array($array)) {
		return false;
	}

	$total = 0;

	if (isset($array[$key]) && is_array($array[$key])) {
		$total = array_sum($array[$key]);
	}
	else {
		foreach ($array as $row) {
			if (is_array($row) && isset($row[$key])) {
				$total += $row[$key];
			}
		}
	}

	return $total;
}
function arraySumField($array, $key) { return array_sum_field($array, $key); }


/** function implode_full [implodeFull]
 *		Much like implode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create URL GET strings from arrays
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param array
 * @param bool optional URL encode flag
 * @return string
 */
function implode_full($separator, $divider, $array, $url = false)
{
	if ( ! is_array($array) || (0 == count($array))) {
		return $array;
	}

	$str = '';
	foreach ($array as $key => $val) {
		$str .= $key.$divider.$val.$separator;
	}

	$str = substr($str, 0, -(strlen($separator)));

	if ($url) {
		$str = url_encode($str);
	}

	return $str;
}
function implodeFull($separator, $divider, $array, $url = false) { return implode_full($separator, $divider, $array, $url); }


/** function explode_full [explodeFull]
 *		Much like explode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create arrays from URL GET strings
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param string
 * @param bool optional URL encode flag
 * @return array
 */
function explode_full($separator, $divider, $string, $url = false)
{
	// explode the string about the separator
	$first = explode($separator, $string);

	// now go through each element in the first array and explode each about the divider
	foreach ($first as $element) {
		list($key, $value) = explode($divider, $element);
		$array[$key] = $value;
	}

	return $array;
}
function explodeFull($separator, $divider, $string, $url = false) { return explode_full($separator, $divider, $string, $url); }


/** function kshuffle
 *		Exactly the same as shuffle except this function
 *		preserves the original keys of the array
 *
 * @param array the array to shuffle by reference
 * @return array
 */
function kshuffle( & $array)
{
	uasort($array, create_function('$a,$b', 'rand(1, -1);'));
}


/** function array_merge_plus
 *		Exactly the same as array_merge except this function
 *		allows entry of non-arrays without throwing errors
 *		If an empty argument is encountered, it removes it.
 *		If a non-empty, non-array value is encountered,
 *		it appends it to the array in the order received.
 *
 * @param mixed item to merge into array
 * @param ...
 * @return array merged array
 */
function array_merge_plus($array1) {
	// grab the arguments of this function
	// and parse through them, removing any empty arguments
	// and converting non-empty, non-arrays to arrays
	$args = func_get_args( );
	foreach ($args as $key => $arg) {
		if ( ! is_array($arg)) {
			if (empty($arg)) {
				unset($args[$key]);
				continue;
			}
		}

		$args[$key] = (array) $arg;
	}

	// generate an eval string to pass the clean arguments to array_merge
	$eval_string = '$return = array_merge(';
	foreach ($args as $key => $null) {
		$eval_string .= '$args['.$key.'],';
	}
	$eval_string = substr($eval_string, 0, -1).');';

	$return = false;
	eval($eval_string);

	return $return;
}


function array_compare($array1, $array2) {
	$diff = array(array( ), array( ));

	// Left-to-right
	foreach ($array1 as $key => $value) {
		if ( ! array_key_exists($key, $array2)) {
			$diff[0][$key] = $value;
		}
		elseif (is_array($value)) {
			if ( ! is_array($array2[$key])) {
				$diff[0][$key] = $value;
				$diff[1][$key] = $array2[$key];
			}
			else {
				$new = array_compare($value, $array2[$key]);
				if ($new !== false) {
					if (isset($new[0])) {
						$diff[0][$key] = $new[0];
					}

					if (isset($new[1])) {
						$diff[1][$key] = $new[1];
					}
				}
			}
		}
		elseif ($array2[$key] !== $value) {
			$diff[0][$key] = $value;
			$diff[1][$key] = $array2[$key];
		}
	}

	// Right-to-left
	foreach ($array2 as $key => $value) {
		if ( ! array_key_exists($key, $array1)) {
			$diff[1][$key] = $value;
		}
		// No direct comparison because matching keys were compared in the
		// left-to-right loop earlier, recursively.
	}

	return $diff;
}

Cependant un autre message d'erreur se produit désormais pour le ligne 48:


Bien qu'ayant effectuer des tentatives de modification de cette lignes 48, je ne trouve pas comment annuler ce message.
Pourrais m'aider à trouver la solution?
Merci.
0
jordane45 Messages postés 38140 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 20 avril 2024 4 649 > Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024
16 oct. 2021 à 12:51
Pareil, t'as une quote encore en trop ligne 48
0
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024
16 oct. 2021 à 13:41
J'ai modifié la ligne 48 et le message d'erreur n'apparait plus.
Cependant un autre apparait en ligne 61 sans que je ne puisse en comprendre la raison comme ci dessous:

Avec le script ligne 61:
<?php

/**
 *		ARRAY FUNCTIONS
 * * * * * * * * * * * * * * * * * * * * * * * * * * */


/** function array_trim [arrayTrim]
 *		Performs the trim function recursively on
 *		every element in an array and optionally typecasts
 *		the element to the given type
 *
 * @param mixed csv list or array by reference
 * @param string optional typecast type
 * @return array
 */
function array_trim( & $array, $type = null)
{
	$types = array(
		'int' , 'integer' ,
		'bool' , 'boolean' ,
		'float' , 'double' , 'real' ,
		'string' ,
		'array' ,
		'object' ,
	);

	// if a non-empty string value comes through, don't erase it
	// this is specifically for '0', but may work for others
	$is_non_empty_string = (is_string($array) && strlen(trim($array)));
	if ( ! $array && ! $is_non_empty_string) {
		$array = array( );
	}

	if ( ! in_array($type, $types)) {
		$type = null;
	}

	if ( ! is_array($array)) {
		$array = explode(',', $array);
	}

	/*if ( ! is_null($type)) {
		array_walk_recursive($array, create_function('&$v', '$v = ('.$type.') trim($v);'));
	}*/
	if ( ! is_null($type)) {
		array_walk_recursive($array, function(&$v){
       return '$v = (.$type.) trim($v)';}
	   );
	}
		
	/*else {
		array_walk_recursive($array, create_function('&$v', '$v = trim($v);'));
	}*/
	else {
		array_walk_recursive($array, function(&$v){
		return '$v = trim($v)';
	}
	

	return $array; // returns by reference as well
}
function arrayTrim( & $array, $type = null) { return array_trim($array, $type); }


/** function array_clean [arrayClean]
 *		Strips out the unnecessary bits from an array
 *		so it can be input into a database, or to just
 *		generally clean an array of fluff
 *
 * @param array data array to be cleaned
 * @param mixed csv or array of allowed keys
 * @param mixed optional csv or array of required keys
 * @return array
 */
function array_clean($array, $keys, $reqd = array( ))
{
	if ( ! is_array($array)) {
		return array( );
	}

	array_trim($keys);
	array_trim($reqd);

	$keys = array_unique(array_merge($keys, $reqd));

	if (empty($keys)) {
		return array( );
	}

	$return = array( );
	foreach ($keys as $key) {
		if (in_array($key, $reqd) && (empty($array[$key]))) {
			throw new Exception(__FUNCTION__.': L\'élement requis ('.$key.') est manquant');
		}

		if (isset($array[$key])) {
			$return[$key] = $array[$key];
		}
	}

	return $return;
}
function arrayClean($array, $keys, $reqd = array( )) { return array_clean($array, $keys, $reqd); }


/** function array_transpose [arrayTranspose]
 *		Transposes a 2-D array
 *		array[i][j] becomes array[j][i]
 *
 *		Not to be confused with the PHP function array_flip
 *
 * @param array
 * @return mixed array (or bool false on failure)
 */
function array_transpose($array)
{
	if ( ! is_array($array)) {
		throw new Exception(__FUNCTION__.': Les données ne constituaient pas un array');
	}

	$return = array( );
	foreach ($array as $key1 => $value1) {
		if ( ! is_array($value1)) {
			continue;
		}

		foreach ($value1 as $key2 => $value2) {
			$return[$key2][$key1] = $value2;
		}
	}

	if (0 == count($return)) {
		return false;
	}

	return $return;
}
function arrayTranspose($array) { return array_transpose($array); }


/** function array_shrink [arrayShrink]
 *		Returns all elements with second level key $key
 *		from a 2-D array
 *		e.g.-
 *			$array[0]['foo'] = 'bar';
 *			$array[1]['foo'] = 'baz';
 *
 *		array_shrink($array, 'foo') returns
 *			array(
 *				[0] = 'bar'
 *				[1] = 'baz'
 *			)
 *
 *		This function returns the input if it is not
 *		an array, or returns false if the key is not
 *		present in the array
 *
 * @param array data array
 * @param mixed second level key
 * @return mixed array (or original input or bool false on failure)
 */
function array_shrink($array, $key)
{
	if ( ! is_array($array)) {
		return $array;
	}

	$array = array_transpose($array);

	if ( ! isset($array[$key])) {
		return false;
	}

	return $array[$key];
}
function arrayShrink($array, $key) { return array_shrink($array, $key); }


/** function array_sum_field [arraySumField]
 *		Returns the sum of all elements with key $key
 *		from a 2-D array, no matter if $key is a first level
 *		or second level key
 *
 * @param array
 * @param mixed element key
 * @return mixed float/int total (or bool false on failure)
 */
function array_sum_field($array, $key)
{
	if ( ! is_array($array)) {
		return false;
	}

	$total = 0;

	if (isset($array[$key]) && is_array($array[$key])) {
		$total = array_sum($array[$key]);
	}
	else {
		foreach ($array as $row) {
			if (is_array($row) && isset($row[$key])) {
				$total += $row[$key];
			}
		}
	}

	return $total;
}
function arraySumField($array, $key) { return array_sum_field($array, $key); }


/** function implode_full [implodeFull]
 *		Much like implode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create URL GET strings from arrays
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param array
 * @param bool optional URL encode flag
 * @return string
 */
function implode_full($separator, $divider, $array, $url = false)
{
	if ( ! is_array($array) || (0 == count($array))) {
		return $array;
	}

	$str = '';
	foreach ($array as $key => $val) {
		$str .= $key.$divider.$val.$separator;
	}

	$str = substr($str, 0, -(strlen($separator)));

	if ($url) {
		$str = url_encode($str);
	}

	return $str;
}
function implodeFull($separator, $divider, $array, $url = false) { return implode_full($separator, $divider, $array, $url); }


/** function explode_full [explodeFull]
 *		Much like explode, but including the keys with an
 *		extra divider between key-value pairs
 *		Can be used to create arrays from URL GET strings
 *
 * @param string separator between elements (for URL GET, use '&')
 * @param string divider between key-value pairs (for URL GET, use '=')
 * @param string
 * @param bool optional URL encode flag
 * @return array
 */
function explode_full($separator, $divider, $string, $url = false)
{
	// explode the string about the separator
	$first = explode($separator, $string);

	// now go through each element in the first array and explode each about the divider
	foreach ($first as $element) {
		list($key, $value) = explode($divider, $element);
		$array[$key] = $value;
	}

	return $array;
}
function explodeFull($separator, $divider, $string, $url = false) { return explode_full($separator, $divider, $string, $url); }


/** function kshuffle
 *		Exactly the same as shuffle except this function
 *		preserves the original keys of the array
 *
 * @param array the array to shuffle by reference
 * @return array
 */
function kshuffle( & $array)
{
	uasort($array, create_function('$a,$b', 'rand(1, -1);'));
}


/** function array_merge_plus
 *		Exactly the same as array_merge except this function
 *		allows entry of non-arrays without throwing errors
 *		If an empty argument is encountered, it removes it.
 *		If a non-empty, non-array value is encountered,
 *		it appends it to the array in the order received.
 *
 * @param mixed item to merge into array
 * @param ...
 * @return array merged array
 */
function array_merge_plus($array1) {
	// grab the arguments of this function
	// and parse through them, removing any empty arguments
	// and converting non-empty, non-arrays to arrays
	$args = func_get_args( );
	foreach ($args as $key => $arg) {
		if ( ! is_array($arg)) {
			if (empty($arg)) {
				unset($args[$key]);
				continue;
			}
		}

		$args[$key] = (array) $arg;
	}

	// generate an eval string to pass the clean arguments to array_merge
	$eval_string = '$return = array_merge(';
	foreach ($args as $key => $null) {
		$eval_string .= '$args['.$key.'],';
	}
	$eval_string = substr($eval_string, 0, -1).');';

	$return = false;
	eval($eval_string);

	return $return;
}


function array_compare($array1, $array2) {
	$diff = array(array( ), array( ));

	// Left-to-right
	foreach ($array1 as $key => $value) {
		if ( ! array_key_exists($key, $array2)) {
			$diff[0][$key] = $value;
		}
		elseif (is_array($value)) {
			if ( ! is_array($array2[$key])) {
				$diff[0][$key] = $value;
				$diff[1][$key] = $array2[$key];
			}
			else {
				$new = array_compare($value, $array2[$key]);
				if ($new !== false) {
					if (isset($new[0])) {
						$diff[0][$key] = $new[0];
					}

					if (isset($new[1])) {
						$diff[1][$key] = $new[1];
					}
				}
			}
		}
		elseif ($array2[$key] !== $value) {
			$diff[0][$key] = $value;
			$diff[1][$key] = $array2[$key];
		}
	}

	// Right-to-left
	foreach ($array2 as $key => $value) {
		if ( ! array_key_exists($key, $array1)) {
			$diff[1][$key] = $value;
		}
		// No direct comparison because matching keys were compared in the
		// left-to-right loop earlier, recursively.
	}

	return $diff;
}


Y aurait il une erreur ligne 57?
0
jordane45 Messages postés 38140 Date d'inscription mercredi 22 octobre 2003 Statut Modérateur Dernière intervention 20 avril 2024 4 649
16 oct. 2021 à 14:01
Ligne 58 il manque une parenthèse fermante
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Max747 Messages postés 258 Date d'inscription vendredi 11 juillet 2014 Statut Membre Dernière intervention 11 janvier 2024
16 oct. 2021 à 18:04
Merci.
C'est résolu.
0