cannot pass parameter 1 by reference


Zorono

So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error...

my code:

namespace John; 
class SP {

const Supported_Version = array('a', 'b', 'c'); 

    public function VersionCheck()
    {
        return ($ver == end(Self::Supported_Version) ? (True)  : (False)); 
     }
 }
Abra Cadaver

You cannot create a reference to a constant because it cannot be changed and can only end()accept parameters by reference. If you really need a constant, assign to a temporary variable. You can do this during a call.

Also, you don't need a ternary, because ==the comparison will return an trueOR false:

return ($ver == end($s = Self::Supported_Version));

Related


fatal error: cannot pass parameter 1 by reference

Balivan's legs I have this line: $stmt->bind_result('d', $keyarray['payment_gross']); I get this error: Fatal error: Cannot pass parameter 1 by reference in /home/star1231/public_html/pdt.php on line 35 I read threads about this error but I didn't find anythi

"Cannot pass parameter 2 by reference" error in PHP

username When I run this code to update my LikedOne column and leave it empty ("")... . $sql11 = $conn->prepare("UPDATE UserData SET likedOne=? WHERE username=?"); $sql11->bind_param('ss',"",$Username); $Username = "netsgets"; $sql11->execute()

How to fix php error "Cannot pass parameter 1 by reference"?

Sailor Moon I know there are many questions on stackoverflow similar to this error, but none of them solved my problem. I have a function in a high_contrast.modulefile : function high_contrast_install() { $background = \Drupal::config('high_contrast.settings

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

fatal error: cannot pass parameter 1 by reference

Balivan's legs I have this line: $stmt->bind_result('d', $keyarray['payment_gross']); I get this error: Fatal error: Cannot pass parameter 1 by reference in /home/star1231/public_html/pdt.php on line 35 I read threads about this error but I didn't find anythi

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

How to fix php error "Cannot pass parameter 1 by reference"?

Sailor Moon I know there are many questions on stackoverflow similar to this error, but none of them solved my problem. I have a function in a high_contrast.modulefile : function high_contrast_install() { $background = \Drupal::config('high_contrast.settings

cannot pass parameter 2 by reference

username Code: final class SimpleEventManager { private $listeners = array(); public function listen($event, $callable) { $this->listeners[$event][] = $callable; } public function fire($event, array $arguments = array()) { for

cannot pass parameter 2 by reference

username Code: final class SimpleEventManager { private $listeners = array(); public function listen($event, $callable) { $this->listeners[$event][] = $callable; } public function fire($event, array $arguments = array()) { for

Cannot pass parameter by reference - MySQLi

ramp I have a problem with my insert query. I am trying to get the user id from a session variable and insert it into a table along with other variables entered through the form. I tried printing the $userid variable and it showed 1, which is correct. The bind

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

How to fix php error "Cannot pass parameter 1 by reference"?

Sailor Moon I know there are many questions on stackoverflow similar to this error, but none of them solved my problem. I have a function in a high_contrast.modulefile : function high_contrast_install() { $background = \Drupal::config('high_contrast.settings

Laravel 8 job cannot pass parameter 1 by reference error

Ryan H I am working on a Laravel 8 project and have created a job that is processed. I have several functions to extract features but I get the following error: Argument 1 cannot be passed by reference The trace originally said on line 65, it would be, 'title'

fatal error: cannot pass parameter 1 by reference

Balivan's legs I have this line: $stmt->bind_result('d', $keyarray['payment_gross']); I get this error: Fatal error: Cannot pass parameter 1 by reference in /home/star1231/public_html/pdt.php on line 35 I read threads about this error but I didn't find anythi

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_

How to fix php error "Cannot pass parameter 1 by reference"?

Sailor Moon I know there are many questions on stackoverflow similar to this error, but none of them solved my problem. I have a function in a high_contrast.modulefile : function high_contrast_install() { $background = \Drupal::config('high_contrast.settings

How to fix php error "Cannot pass parameter 1 by reference"?

Sailor Moon I know there are many questions on stackoverflow similar to this error, but none of them solved my problem. I have a function in a high_contrast.modulefile : function high_contrast_install() { $background = \Drupal::config('high_contrast.settings

cannot pass parameter 2 by reference

username Code: final class SimpleEventManager { private $listeners = array(); public function listen($event, $callable) { $this->listeners[$event][] = $callable; } public function fire($event, array $arguments = array()) { for

cannot pass parameter 1 by reference

Zorono So I'm trying to check if the value of the variable is equal to the last row of the array, if($ver == end(Self::Supported_Version) {}but it results in Cannot Pass Parameter 1 by referencean error... my code: namespace John; class SP { const Supported_