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
- Sorting list of sites from multisite network using wp_get_sites
- How to store the_title() into a variable to reutrn the value, not just echo it
- How to loop through JSON data in wordpress WP REST API
- WP API V2 returning Invalid User ID
- How to update single value in multi dimensional Post Meta?
- Export all post from database to JSON only when the database gets updated
- Create a new user using WP REST API and declare meta object
- Looping through WP_Post Object
- Using a javascript file to access a get posts array
- Gutenberg custom block using only register_block_type() and HTML
- Generate an array of parent/child page IDs, based on parent page name
- How do I output a database option that is an array into a get_posts array?
- How do I dynamically generate args for wp_query?
- Check if term object is in array
- How to send user data in json format to another server when user register on wordpress site in PHP
- Create dynamic pages from external JSON data without storing in Database?
- Vagrantpress + composer
- Working with query_posts ( arrays and query strings)
- Remove duplicates – array_unique()
- How to properly loop through these external URLs to get them into the sitemap using this hook
- Recent posts with featured image or fallback image with permalink
- Call global variable array() in woocommerce child/template
- Storing Array from returned database query and using the array in a new query
- Populate dropdown with Child Pages based on Parent Page chosen
- PHP Array Returning [object Object]. Tried existing answers results with no luck
- Exclude posts based on meta value
- wp_enqueue_script seperately for each shortcode
- Input data from email form not going to JSON file
- Fetching instagram api not working on wordpress
- Alter required message using comment form api
- Advanced Custom Fields – display label and value only if value entered
- wp_force_remove_style’ not found
- How can I access string value in an array?
- 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
- 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?
- Get categories names as an array to use it in theme settings
- How to get the last category name of a child category?
- Foreach loop inside an array_merge
- If Array Values Match Another Array’s Values, Then
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Getting posts to exclude from array
- entire JS folder not loading in a WP theme
- I’m unable to call img path using single quotes in an array?
- Retrieve Json data and create multiple pages with it
- 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
- 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
- Update value of a associative array with update_post_meta
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- Add custom fields from different posts
- MySQL Query Returns Array () In Shortcode
- Order users by random not working?
- in_array not working on dev server but works on localhost
- 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 display MySQL table data which is stored as an array?
- 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?
- Notice : Array to string conversion on array_intersect user meta
- 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 < "
- Display posts using post ID’s in an array
- Display a single row from nested array of custom field data
- AJAX Filter WHILE Loop not working WordPress
- How to use foreach and if statement within array of arrays?
- Reformat data within a nested array
- How to find the function which is outputting Array
- Create Customization Controls from Array
- Exclude Post ID from Array Specified in Custom Field
- Setting pages for posts
- !in_array doesnt recognize category
- How to set if meta_value is lower < than other meta_value in a get_posts array?
- WordPress format json in postmeta table
- How to post data to a word press site in case of a mobile app
- Populate checkboxes from array
- PHP Use Declared array Variable inside already Declared Array
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Why is my array_diff usage breaking things?
- save array of objects with update_option
- REST API custom endpoints for metaboxes
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Replace block content with an array
- Adding date and time to the same request