V
V
Vladimir2018-02-10 03:21:56
PHP
Vladimir, 2018-02-10 03:21:56

How to pass 2 values ​​​​into an array but so that it is perceived as one in the array?

Example: you need to pull out 2 fields name and id from the base, and put them into the array as one! How to implement this?
Example:
id | name
1 | admin
in array:
admin1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael Saparov, 2018-02-10
@vovaburyii

Sorry, maybe I didn't understand the question. But just concatenate the values.
For example:
$arr[] = "$value1"."$value2";
This element will be listed as the last element of the array.

S
Sergey Gerasimov, 2018-02-10
@mrTeo

When fetching, use concatenation:
SELECT CONCAT(name,id) AS slug FROM users

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question