PHP &$string – What does this mean?

You are assigning that array value by reference. passing argument through reference (&$) and by $ is that when you pass argument through reference you work on original variable, means if you change it inside your function it’s going to be changed outside of it as well, if you pass argument as a copy, function … Read more

Send email with PHP from html form on submit with the same script

EDIT (#1) If I understand correctly, you wish to have everything in one page and execute it from the same page. You can use the following code to send mail from a single page, for example index.php or contact.php The only difference between this one and my original answer is the <form action=”” method=”post”> where the action has been left … Read more

PHP password_hash(), password_verify()

Here is what I use for password_hash and password_verify. Try it out as written, you can then start adding in the rest of your code once successful. Modify table and column name(s) to suit. N.B.: This is a basic insertion method. I suggest you use prepared statements instead. Sidenote: The password column needs to be long enough to accomodate the hash VARCHAR(255). … Read more

Invalid argument supplied for foreach()

Personally I find this to be the most clean – not sure if it’s the most efficient, mind! The reason for my preference is it doesn’t allocate an empty array when you’ve got nothing to begin with anyway.

.rar, .zip files MIME Type

The answers from freedompeace, Kiyarash and Sam Vloeberghs: I would do a check on the file name too. Here is how you could check if the file is a RAR or ZIP file. I tested it by creating a quick command line application. Notice that it still won’t be 100% certain, but it is probably … Read more

Email Not Sending from Byethost Hosting

I deployed my website and I’m trying to send an email from my website that is hosted by Byethost and it displays a success message but for some reason the email is not being received. What might be the problem? Below you will find the PHP script.

why use 0xffff over 65535

The hexadecimal notation 0xffff makes it clear that all bits in the number are 1. The 65535 is the same number, but the binary representation isn’t as obvious. It’s only a count number. So this way of writing numbers has different semantics. For example, if you want to declare that the maximum value of some variable must be 65535, then … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)