-1

I get the following error bellow and was wondering how can I correct this error

Fatal error: Can't use function return value in write context in

PHP code

$number = '1,200.91';
$number = str_replace(',', '', $number);
$number = number_format((float)$number, 2, '.', '');

if(strlen($number) = 7){
    echo $number;
}

2 Answers2

2

= is not the same as ==

Code should be like this: if(strlen($number) == 7){

nospor
  • 4,190
  • 1
  • 16
  • 25
0

You are missing the == in the if statement

change this line:

if(strlen($number) = 7){

to:

if(strlen($number) == 7){
Osama Sayed
  • 1,993
  • 15
  • 15