366 solutions found in php-dev
Page 15 of 19votes
Is there a way to convert an integer to a string in PHP?
votes
`players ` will either be empty or a comma separated list (or a single value). What is the easiest way to check if it's empty? I'm assuming I can do so...
votes
I have seen uses of `@` in front of certain functions, like the following: $fileHandle = @fopen($fileName, $writeAttributes); What is the use of this...
votes
Can anyone show me how to do a PHP cURL with an HTTP POST? I want to send data like this: username=user1, password=passuser1, gender=1 To `www.exam...
votes
How can I insert a new item into an array on any position, for example in the middle of array?
votes
The question is simple. I have a `foreach` loop in my code: foreach($array as $element) { //code } In this loop, I want to react differe...
votes
I would like to create helper functions to avoid repeating code between views in Laravel. For example: *view.blade.php* <p>Foo Formated text: {{...
votes
Given this array: $inventory = array( array("type"=>"fruit", "price"=>3.50), array("type&q...
votes
I can use `set_error_handler()` to catch most PHP errors, but it doesn't work for fatal (`E_ERROR`) errors, such as calling a function that doesn't exis...
votes
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 `==` 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...