how to convert typeint to type array?
In fact the value q "'we stored in the database is like this a: 1: {i: 0; i: 30;} but when I do research I simply entered 30
I want to do this
request
SELECT * FROM product WHERE price = 30
instead of
SELECT * FROM product WHERE price = "a: 1: {i: 0; i: 30;}"
My Answer:
can be easily converted to an array in PHP by using the `str_split()` function. Here is an example code snippet to convert an integer to an array:
php
$value = 12345;
$array = str_split($value);
print_r($array);
This will output:
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)
In this example, the integer `12345` is converted to an array where each digit is a separate element in the array.
Rate this post
4 of 5 based on 7212 votesComments