Skip to content
Advertisement

Why is my PHP Code not Working , HTML website?

Ok so i made a HTML website for a school project and i tried incorporating into it a ” Contact Us ” section in which u give your name , email and a message to be sent to my adress. I can’t seem to find any error into the code . When i am trying to send the info ,

Private property in parent class can be accessed and re-assigned through the instance of child class in PHP but protected one can’t

I am very confused why $produk1->harga = 500; can still make a change (or re-assign the value 500) to private $harga property despite private $harga in class Produk has PRIVATE visibility ? $product1 is an instance of class Komik. $produk1 = new Komik(“Naruto”, “Masashi Kishimoto”, “Shonen Jump”, 30000, 100); And by echo $produk1->harga; it prints out 500 and not an

php: Add value to exsiting key in array

I have an array: I want to add one or more value to the “email”. What I want to achieve is: Is there a way to push it? Answer You can do this, but you should be clear that it’s what you want to do. If you change the datatype of any part of your program there could be unexpected

delete or undo the first query if the second query did not work

im confused about this. Is there any way like to test if all queries are working and not returning erros? if so execute them or return something. I am building a signup method, this have 2 parts: loginInfo(username, password) and the usual Employee info (name, email, etc..). The signup method inserts the Employee info into employee table, then it gets

Weird PHP Regex Preg_Match Bug?

My PHP version is PHP 7.2.24-0ubuntu0.18.04.7 (cli). However it looks like this problem occurs with all versions I’ve tested. I’ve encountered a very weird bug when using preg_match. Anyone know a fix? The first section of code here works, the second one doesn’t. But the regex itself is valid. For some reason the something_happened word is causing it to fail.

PHP JWT (JSON Web Token) with RSA signature without library

Anyboby know some solution in PHP to using JWT (JSON Web Token) with RSA signature without library? I tried so hard to find solutions without library or without using composer. All the options that I found use some kind of library. Answer I made my own solution using other examples on the way. Below we have 3 use cases and

How to use .env file in smarty?

I am new to smarty template. My all database settings are in /inc/settings/DSOPSettings.local.php but Every time I get pull from git for changes It overrides. I have tried to set .env file in smarty template project root tried to get env variables in DSOPSettings.local.php file but It’s not working for me. My .env file : My DSOPSettings.local.php : I have

Advertisement