What is the advantage of using try {} catch {} versus if {} else {}

I’d use the try/catch block when the normal path through the code should proceed without error unless there are truly some exceptional conditions — like the server being down, your credentials being expired or incorrect. I wouldn’t necessarily use it to handle non-exceptional errors — say like the current user not being in the correct … Read more

How to extract and access data from JSON with PHP?

Intro First off you have a string. JSON is not an array, an object, or a data structure. JSON is a text-based serialization format – so a fancy string, but still just a string. Decode it in PHP by using json_decode(). Therein you might find: scalars: strings, ints, floats, and bools nulls (a special type … Read more

Unzip a file with php

I can only assume your code came from a tutorial somewhere online? In that case, good job trying to figure it out by yourself. On the other hand, the fact that this code could actually be published online somewhere as the correct way to unzip a file is a bit frightening. PHP has built-in extensions … Read more

How to use PHP inside css file

If you’re able to rename your CSS file “layout.php”, there’s no need for all of these workarounds: Your layout.php file would look like: Your HTML files would look like: This question is very similar: Include: css with php file extension?

Error:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

this code working on localhost but when i am testing on my live server it will give me this error Error:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure then i tried this github.com/paypal/TLS-update/tree/master/php this will again work on localhost and on live it gives me this my server have these certificates Server Key and Certificate #1 #2 #3 … Read more

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