There are a few ways you can make an integer a string. Here are 2 main ways to make that happen
-
Type Cast –
$values_x[] = (string) $series[0]['data'][$i][0]
-
Double Quote –
$values_x[] "{$series[0]['data'][$i][0]}"
Also, you might want to check for null first and assign a default
$values_x = !empty($values_x) ? $values_x : array('2010');
If you want to make the whole array a string, use implode
"values" => implode(', ', $values_x)
If you have multiple integers, this will output ‘2010, 2011’. Replace the comma and space with what you want placed between the pieces.
Related Posts:
- Parsing php string in jquery [closed]
- Sending simple variable on single page to WP JSON
- get_body_params() is always empty in POST request
- How to pass php array to external js file in WordPress
- How to use if statement in an array? [closed]
- How to array only one key from another array
- Filtering a function’ output for a new continued function
- Get html data with javascript to php array and store to wordpress database
- How do I create a numbered list with PHP? [closed]
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- How to use array in function to get only value I want
- Error while setting role
- Get categories names as an array to use it in theme settings
- How to get the last category name of a child category?
- How to say if meta_value is greater than 0 in an array?
- How to use two meta_compare in an array?
- Warning: in_array() null given in PHP function
- Foreach loop inside an array_merge
- Loop over Array and get the distinct ids
- How to access or parse key/values that have “string”
- If Array Values Match Another Array’s Values, Then
- Remove empty terms from array, sort alphabetically, update back to repeating field
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Only show first image in foreach loop
- Conditional multidimensional arrays and array_map
- How can I get all values from my array in a loop in php? [closed]
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- entire JS folder not loading in a WP theme
- I’m unable to call img path using single quotes in an array?
- Filter by field with array value in ACF on WP REST API
- extract serialized array to use for wp-query
- Retrieve Json data and create multiple pages with it
- get users search not working with array
- How to clone all WordPress Rest API end points
- Comapare get_user_meta value
- How can get all users by current user meta?
- Get the id of all images in a post
- Output category list inside array
- how to make an array of post id’s in is_single
- How can I split my query result in 2 arrays?
- Multidimensional Array
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- Separate array output into a
- array_rand not working correctly?
- Get css class of menu item in custom menu structure
- Dynamically adding filters
- Order a WP_Query by meta value where the value is an array
- Only load certain artists on this page
- add the value of a variable returned in a while loop [closed]
- Update value of a associative array with update_post_meta
- How to make sure relative URL works when site is not on root domain?
- Get URI from PodPress using PHP
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- using images in next/previous_post_link [closed]
- Finding and removing duplicates within WP Arrays
- Using multiple variables to assign categories to an array
- Custom functions for string data calculations
- Add custom fields from different posts
- Repeat a function with 24hrs gap for n number of days
- MySQL Query Returns Array () In Shortcode
- Problem with inserting multiple images in gallery of each WooCommerce product programmatically
- Convert a column of a table containing an Array as response in HTML
- Create an array with all the links of the years’ archive (of a custom post type)
- Display just one post from a loop of 5 posts?
- Order users by random not working?
- Redux option doensn’t seem when include from functions.php
- in_array not working on dev server but works on localhost
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page?
- how to separate an array into different arrays and save them into db?
- How to insert multiple rows and columns in database using array
- Display one random image from Media Library
- How to display MySQL table data which is stored as an array?
- Issue with json decode in WordPress – value is not returning consistently
- ACF – Get ID of relationship field in flexible content
- Replace an array (with identical values) with another array in the_content
- How does one make a URL return dynamic JSON with custom Content Type?
- Show the subcategory name based on current product
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- How to filter specific element of an array in wordpress/php?
- WP post meta – for loop inside for loop
- Need help to create WordPress page that decodes a text file and publishes it in JSON format
- get_category_parents to array
- Notice : Array to string conversion on array_intersect user meta
- Combine multiple queries, array_unique returns nothing
- Store custom field’s multiple values in one user meta key
- Remove item from post_meta array via AJAX
- Make sticky post with FacetWP
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- wp_send_json erase last value
- PHP array to jQuery array ” Uncaught SyntaxError: Unexpected token < "
- Complex PHP for json_encode > how to handle/output right?
- Can’t get_users info by using json_encode
- get_users when from meta key that has serialized values
- make an array in wordpress cusmization api?
- Trouble with checked() for array of multiple checkboxes
- How can get all users by current user meta (array)?
- Display posts using post ID’s in an array
- How can i iterate through this shortcode array?