Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
php7.2
- Page 1
Dynamic Properties in PHP 8.2
Programming
Web Development
3 Weeks Ago
by Dani
… things start breaking after a PHP upgrade. With PHP 8.
2
, there’s a new warning that’s catching a lot…
Re: Dynamic Properties in PHP 8.2
Programming
Web Development
3 Weeks Ago
by Dani
Oh, and an important bit I forgot to mention: PHP's built-in stdClass has the `#[AllowDynamicProperties]` attribute already added. In fact, you can see in the [PHP docs](https://www.php.net/manual/en/class.stdclass.php) that the definition of the stdClass is "a generic empty class with dynamic properties." That means that you can always …
Re: Dynamic Properties in PHP 8.2
Programming
Web Development
2 Weeks Ago
by Dani
… to create temporary objects: // Create a PHP object and set
2
properties $temp_obj = new StdClass(); $temp_obj->foo = 'bar'; $temp_obj-&…gt;baz = 'bat'; // Create a PHP array with
2
elements $temp_arr = array( 'foo' => 'bar'; 'baz' => 'bat'; ); // …
Re: Dynamic Properties in PHP 8.2
Programming
Web Development
2 Weeks Ago
by jkon
I can't get it , why anyone would want to `$user = new User(); $user->nickname = 'Dani';` if nickname is not a public property of User , or even worse `$user = new stdClass(); $user->nickname = 'Dani';` ? Why ?
Re: Dynamic Properties in PHP 8.2
Programming
Web Development
2 Weeks Ago
by Dani
> This obviously does not make sense to do if you want to create or work with a User object or something of that sort. I realize that in my previous post I incorrectly gave the example of `$user = new stdClass(); $user->nickname = 'Dani';`. My intention was not to say that it was good coding practice to represent a user of the app with an …
Safely upload a file
Programming
Web Development
2 Weeks Ago
by Dani
Here's a quick bit of code to upload a file in PHP.
Re: How to show visa info based on country selection in a travel form?
Programming
Web Development
2 Weeks Ago
by Biiim
I felt like some fun, so I just put together an example for you using CDN's and bootstrap 5. From what you are talking about you probably want to put some of that logic into the Javascript and not need to send a server request for each one, I usually do this kind of thing with javascript objects/arrays (eg `settings['GB']['visa_req'] = false;…
Re: How to show visa info based on country selection in a travel form?
Programming
Web Development
3 Weeks Ago
by Dani
I have moved your post into the web development forum instead of the advertising/marketing forum where it was and tagged it appropriately. Can you please provide the Javascript code as well as PHP code that is buggy so that we can help diagnose this for you. For example, if the JSON response is empty, it is most likely because of a bug in the …
How to show visa info based on country selection in a travel form?
Programming
Web Development
3 Weeks Ago
by eservices
I’m working on a travel planning form that adjusts based on the selected nationality. For example, if someone picks a country like India, the form should display whether they need an electronic visa for places like Sri Lanka, and maybe show a short message or guide link. I’m using JavaScript to detect changes in a <select> dropdown and …
Re: How to show visa info based on country selection in a travel form?
Programming
Web Development
3 Weeks Ago
by groverharleen
Hello, please use developer tool while working on HTML/PHP with AJAX. in the console you can easily track what was the POST/GET request made to PHP file and what is the responses shared by PHP file. try debugging response accordingly or if still you face any trouble, please do share screen shot of Header / Request / Response Tabs. i'll …
Is anyone using ChatGPT in French for programming tasks?
Programming
1 Week Ago
by kakasi63
Hi everyone, I've recently started exploring ChatGPT in the French language for programming help, and I was surprised at how effective it can be — even when working with frameworks like Laravel or JavaScript. For example, I asked it to generate a Laravel controller with French comments, and the output was both functional and easy to …
Re: Safely upload a file
Programming
Web Development
2 Weeks Ago
by Dani
I realize I could have done better when coming up with a safe name. As it stands, a file uploaded that has a file name in non-Latin characters will just end up with a bunch of underscores. I’m not even sure if that suffices as a file name, but for sure there will be collisions as multiple files are attempting to be saved with the same _ name.
Re: Safely upload a file
Programming
Web Development
1 Week Ago
by john_111
You should display a message acknowledging the upload was successful or that it failed (and why it failed), and perhaps it's new name.
Re: Safely upload a file
Programming
Web Development
1 Week Ago
by Dani
I feel like that's part of the UI that would be very different depending upon the context. For example, what would the message look like? This is meant to just be a backend utility function.
Re: Flood control using Redis
Programming
Web Development
2 Weeks Ago
by Dani
Status update: we now use Cloudflare’s free rate limiting functionality. Back when I wrote this, Cloudflare charged for rate limiting. Note we have a Business account.
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Dani
I am confused when you say the HTML time picker input box can be set to 20:00 for time in and 5:00 for time out, because `<input type="time" ...>` only allows the end-user to specify a time, not a time and date combination. Should it always be assumed that if the time out is earlier than the time in, that it is the next day? …
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Dani
In other words, if you just need days or hours you can do something like `$diff->d` or `$diff->h` (All properties available [here](https://www.php.net/manual/en/class.dateinterval.php), but if you want to calculate a runner's start time and end time and then do something like "You ran the race in 08:33:56!" then you could use the `…
Re: How to connect to the Pinterest API using PHP?
Programming
Web Development
1 Month Ago
by geekinformatic
Hey! If you're using the CakePHP framework, you can connect to the Pinterest API with cURL and OAuth integration. Just follow Pinterest’s API docs for endpoints and token handling.
Re: How do I remove the last character without breaking the string?
Programming
Web Development
1 Month Ago
by MAY_261
Use mb_substr() instead of substr(). It handles multibyte characters and emojis correctly. Here is the correct code: $text = "私の名前はダバーです👩🚀"; $length = mb_strlen($text, 'UTF-8'); $new_text = mb_substr($text, 0, $length - 1, 'UTF-8'); echo $new_text; https://flatcoding.com/tutorials/php/php-remove-last-…
Re: How do I remove the last character without breaking the string?
Programming
Web Development
1 Month Ago
by Montasser_1
> Use mb_substr() instead of substr(). It handles multibyte characters and emojis correctly. > > Here is the correct code: > > > > $text = "私の名前はダバーです👩🚀"; > $length = mb_strlen($text, 'UTF-8'); > $new_text = mb_substr($text, 0, $length - 1, 'UTF-8'); > echo $new_text; > …
How do I remove the last character without breaking the string?
Programming
Web Development
1 Month Ago
by Montasser_1
I try to remove the last character from a string with Japanese text and emojis using this code: <?php $text = "私の名前はダバーです👩🚀"; $new_text = substr($text, 0, strlen($text) - 1); echo $new_text; The output breaks the characters and shows garbage. How do I fix this?
My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Mr.M
…:00AM to 11:00AM which means the shift started from
2
in the morning to 11 am of the same day…
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Mr.M
… the register is being marked for. Then I also have
2
time inputs one is for timein and the other is…
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Mr.M
I'm getting an error saying the `date_create` class can not be found
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Dani
Oh goodness, I’m sorry! I made a typo. Remove the new keyword. I’ve edited my post above.
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Mr.M
Thank you, you saved me, I've been trying for weeks now. It works now perfectly with your code.
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Dani
> Also just one more question regarding your code, I will have to minus 1 hour from the total hour difference, do I have to use the %h - 1? Just in case you haven't figured this out yet, the answer is no :) In my code above, see where I am showing you what $diff looks like on line 15? You should be able to do something like this: $…
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Erussuhsh
Hi I'm new to android app development can you teach me how to make a app
Re: My php is showing wrong results of time difference
Programming
Web Development
1 Month Ago
by Dani
I don’t personally know Android development or mobile development at all. However, others here might. Please start a new question [by clicking here](https://www.daniweb.com/community/contribute/181).
Optimizing working with big data
Programming
Software Development
2 Months Ago
by Dani
What are some best practices for optimizing memory management when working with large datasets? I am tagging this topic both with php (because that is my language of choice, and the one I work with big data with) as well as c++ (because I know DaniWeb has a large low level c++ community that is well suited to being able to delve into this topic …
1
2
3
17
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
Backlink Auditor
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC