I have a string that looks like this: 1d20+3d6-4d8+10 I would like to split that into: 1d20, +3d6, -4d8, +10. preg_split() consumes the + and – symbols. What is the best way to tell it “split at …
Tag: php
Android / MySQL: Spinner not populate data from MySQL
I have a problem with my code. I already created a spinner that populates from the MySQL database. The PHP code seem not have problem at all since I run the link “localhost/latihan1/menu/php”, the …
WordPress: Latest post missing from category feed
I have setup a custom field to pull a specified category ID to display using WP_Query on a page’s side bar. It pulls the posts in the correct category, but skips the most recent one. Here is the snip …
Allow users with is_request 1 to not log in
I am currently working on a system where people can submit a registration request. The admin will need to accept the request in order for the user to be able to sign in. In my database, I have a field …
How to show a php radio input value on a php email?
I have a php form with 4 radio inputs as below:
<input type="radio" name="…
Extract specific data from string using Regex (PHP)
My objective is to check if the message have emojis or not , if yes i am going to convert them. I am having a problem to find out how many emojis are in the string. Example : $string = “:+1::+1::+…
I have an array of regex I am replacing with the same character. How would I use or “|” with my regex to lower array count?
I have more setup in my arrays but to keep it simple I’m only placing the ones with which I want to group together using or “|”. $patterns = array(); $patterns[1] = “/(?::)/”; $patterns[2] = “/(?:-…
Orderby function with unexpected result
I have setup a query to list my posts ordered by a certain custom field (which is the publish date of the individual books reviewed in my blog). $the_query = new WP_Query(array( ‘post_type’ …
How to pass array as SELECT params for Laravel Query Builder
If I have an AJAX call that returns an array called $selectArray, which is [foo,bar,foobar], how do utilize it in a Laravel Query Builder so that it’s sanitized? Currently, I have It seems awfully unintuitive. Either there are better ways sanitizing the input or passing Array as SELECT without having mu…
Failing to array_merge(), same output prior to loop
I’ve seen numerous related questions, none answered this for me – I apologize if that’s due to my lack of knowledge… I have an array, $contacts, where each record looks like the below, with 1-many …