PHP "Parse error"

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Onaylı Üye
Katılım
27 Şub 2021
Mesajlar
91
Tepki puanı
3
Ödüller
5
Yaş
26
5 HİZMET YILI
İyi forumlar,

Login.php dosyamda bu kodda böyle bir hata var. Bunu nasıl düzeltebilirim?

HATA: Parse error: syntax error, unexpected ':', expecting '{' in C:\xampp\htdocs\admin\login.php on line 4

KOD:

if (!function_exists('str_contains')) { function str_contains(string $haystack, string $needle): bool { return '' === $needle || false !== strpos($haystack, $needle); } }
 
Uzman Üye
Katılım
9 Haz 2020
Mesajlar
223
Tepki puanı
17
Ödüller
6
Yaş
31
5 HİZMET YILI
A parse error: syntax error, unexpected appears when the PHP interpreter detects a missing element. Most of the time, it is caused by a missing curly bracket “}”. To solve this, it will require you to scan the entire file to find the source of the error
 
⭐⭐⭐⭐⭐⭐
Seçkin Üye
Katılım
10 Ara 2017
Mesajlar
355
Çözümler
3
Tepki puanı
63
Ödüller
10
Yaş
24
8 HİZMET YILI
Dowload Loader new !! is now active PHP MY SG VN sever
 
Onaylı Üye
Katılım
15 Haz 2020
Mesajlar
51
Çözümler
1
Tepki puanı
6
Ödüller
4
Yaş
29
5 HİZMET YILI
İyi forumlar,

Login.php dosyamda bu kodda böyle bir hata var. Bunu nasıl düzeltebilirim?

HATA: Parse error: syntax error, unexpected ':', expecting '{' in C:\xampp\htdocs\admin\login.php on line 4

KOD:

if (!function_exists('str_contains')) { function str_contains(string $haystack, string $needle): bool { return '' === $needle || false !== strpos($haystack, $needle); } }
Download new loader
 
Onaylı Üye
Katılım
2 Eki 2020
Mesajlar
56
Çözümler
1
Tepki puanı
3
Ödüller
5
Yaş
26
5 HİZMET YILI
search the entire php file and find there is missing "}"
 
Onaylı Üye
Katılım
10 Ara 2022
Mesajlar
57
Tepki puanı
11
Ödüller
1
Yaş
33
3 HİZMET YILI
check if your drivers are up to date, this is a PHP problem, it is usually corrected with new loader updates
 
Onaylı Üye
Katılım
25 Mar 2022
Mesajlar
51
Tepki puanı
0
Ödüller
3
Yaş
27
4 HİZMET YILI
search the entire php file and find there is missing "}".
 
Onaylı Üye
Katılım
3 Şub 2020
Mesajlar
70
Tepki puanı
16
Ödüller
4
Yaş
27
6 HİZMET YILI
İyi forumlar,

Login.php dosyamda bu kodda böyle bir hata var. Bunu nasıl düzeltebilirim?

HATA: Parse error: syntax error, unexpected ':', expecting '{' in C:\xampp\htdocs\admin\login.php on line 4

KOD:

if (!function_exists('str_contains')) { function str_contains(string $haystack, string $needle): bool { return '' === $needle || false !== strpos($haystack, $needle); } }
What I'm thinking right now is you should download new loader file
 
Onaylı Üye
Katılım
8 Şub 2021
Mesajlar
51
Çözümler
1
Tepki puanı
7
Ödüller
5
Yaş
25
5 HİZMET YILI
update you drivers and search for php files
 
Onaylı Üye
Katılım
30 Haz 2021
Mesajlar
54
Tepki puanı
3
Ödüller
1
Yaş
30
4 HİZMET YILI
try restarting the computer, or look for a cache memory cleaning program.
 
Onaylı Üye
Katılım
16 Tem 2021
Mesajlar
51
Tepki puanı
3
Ödüller
2
Yaş
37
4 HİZMET YILI
The reason for this error is that your PHP version does not support the str_contains function. str_contains was added starting from PHP 8.0.0. If you are using a PHP version before 8.0.0, you may encounter this error.

To fix this error, you can use the strpos function instead of the str_contains function. strpos checks if a string exists in another string.

You can replace the function as follows:
PHP:
if (!function_exists('str_contains')) {
    function str_contains(string $haystack, string $needle): bool
    {
        return '' === $needle || false !== strpos($haystack, $needle);
    }
}

with:

PHP:
if (!function_exists('str_contains')) {
    function str_contains(string $haystack, string $needle): bool
    {
        return '' === $needle || false !== strstr($haystack, $needle);
    }
}

This change replaces the str_contains function with the strstr function, so this function will work regardless of the PHP version you are using.
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst