Skip to content

Tag: string

Extract a YYYmmDD in PHP

I have images and videos from my camera which are uploaded to my server. In order to properly organize them I need to extract the year month and day. But I cant seem to get this pregmatch right.. Input would be 20211215_083437.jpg Output would be Year2021 Month11 Day15 Answer You need to remove the $ anchor in your RegEx to

DQL with between – string date – PHP

I am trying to do a sql with between. The date data is entered first as a string. Any help with this question? Answer The string is dd/mm/yyyy At the final you will get date like 2021-09-28 and now we can do a between with actual date 2021-10-01 after this you can see the sentence in DB with dd($query->getSQL()); function

concatenate array values ‚Äčinto string?

I have this array, is stored in a variable called $ data : and i want to add to another variable to send to an API but when i echo $body the result its like this: how can I add the string to have an output like this: thanks to all Answer If you’re using XML, it’s better to learn

Using PHP preg_replace() with a string variable, where the variable needs to represent multiple permutations of itself

Using: I’d like to replace, case-insensitively, the text contained in $My_String, which I can achieve with: If $My_String is alpha beta gamma delta, this will identify: alPhA beTa GammA DeLta aLpHa bEta gAMma delTa etc. So far, so good. But any spaces and hyphens in $My_String must also be regarded as equivalent. So the preg_replace() function also needs to identify