2108 solutions found
Page 25 of 106votes
Can someone explain the differences between [ternary operator shorthand](https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comp...
votes
What is the difference between `$_SERVER['HTTP_HOST']` and `$_SERVER['SERVER_NAME']` in PHP? When would you consider using one over the other...
votes
What is the difference between `==` and `===`? - How exactly does the loosely `==` comparison work? - How exactly does the strict `===` comparison work?...
votes
I need to get the last character of a string. Say I have "testers" as input string and I want the result to be "s". how can I do that in PH...
votes
Is there a PHP function that returns the date and time in the same format as the MySQL function `NOW()`? I know how to do it using `date()`, but I am asking...
votes
Is it possible to redirect a user to a different page through the use of PHP? Say the user goes to `www.example.com/page.php` and I want to redirect them to...
votes
How can I get the client IP address using PHP? I want to keep record of the user who logged into my website through his/her IP address.
votes
### What is this? This is a number of answers about warnings, errors, and notices you might encounter while programming PHP and have no clue how to fix them....
votes
Which PHP function can return the current date/time?
votes
Some elements in my array are empty strings from users. `$linksArray` still has empty elements after the following: foreach($linksArray as $link) {...
votes
I'm trying to create a randomized string in PHP, and I get absolutely no output with this: <?php function RandomString() {...
votes
I'm integrating an API to my website which works with data stored in objects while my code is written using arrays. I'd like a quick-and-dirty functi...
votes
I saw different binaries for PHP, like non-thread or thread safe? What does this mean? What is the difference between these packages?
votes
I use this code to get the full URL: $actual_link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; The problem is that...
votes
I want to convert these types of values, `'3'`, `'2.34'`, `'0.234343'`, etc. to a number. In JavaScript we can use `Number()`, but is th...
votes
I'm a little confused why I see some code in PHP with string placed in single quotes and sometimes in double quotes. I just know in .NET, or the C langua...
votes
PHP treats all arrays as associative, so there aren't any built in functions. Can anyone recommend a fairly efficient way to check if an array *"is a l...
votes
This is a question you can read everywhere on the web with various answers: $ext = end(explode('.', $filename)); $ext = substr(strrchr($file...
votes
Given the following code: <!-- language: lang-php --> DB::table('users')->get(); I want to get the raw SQL query string that the d...
votes
What is fastest way to remove the last character from a string? I have a string like a,b,c,d,e, I would like to remove the last ',' and get...