
PHP Make a string from an array
- or -
Post a project like this4278
£6(approx. $8)
- Posted:
- Proposals: 4
- Remote
- #291426
- Completed
Description
Experience Level: Entry
I need to make a variable string from an array '$regions'
The string needs to end up like this:
[_title]|[areaSlug], [_title]|[areaSlug], etc for each item in the array
Can anyone help me with the code to achieve this if this was the array:
Array (
[0] => Array ( [_id] => 235 [areaSlug] => head-office [region-area-list] => Head Office [_title] => Head Office [_page] => /careers/homecare/vacancies.php )
[1] => Array ( [_id] => 236 [areaSlug] => merton [region-area-list] => Merton [_title] => Merton [_page] => /careers/homecare/vacancies.php )
[2] => Array ( [_id] => 237 [areaSlug] => wandsworth [region-area-list] => Wandsworth [_title] => Wandsworth [_page] => /careers/homecare/vacancies.php )
[3] => Array ( [_id] => 238 [areaSlug] => sutton [region-area-list] => Sutton [_title] => Sutton [_page] => /careers/homecare/vacancies.php )
[4] => Array ( [_id] => 239 [areaSlug] => southwark [region-area-list] => Southwark [_title] => Southwark [_page] => /careers/homecare/vacancies.php )
[5] => Array ( [_id] => 240 [areaSlug] => ealing [region-area-list] => Ealing [_title] => Ealing [_page] => /careers/homecare/vacancies.php )
[6] => Array ( [_id] => 241 [areaSlug] => brent [region-area-list] => Brent [_title] => Brent [_page] => /careers/homecare/vacancies.php )
[7] => Array ( [_id] => 242 [areaSlug] => croydon [region-area-list] => Croydon [_title] => Croydon [_page] => /careers/homecare/vacancies.php ) )
The string needs to end up like this:
[_title]|[areaSlug], [_title]|[areaSlug], etc for each item in the array
Can anyone help me with the code to achieve this if this was the array:
Array (
[0] => Array ( [_id] => 235 [areaSlug] => head-office [region-area-list] => Head Office [_title] => Head Office [_page] => /careers/homecare/vacancies.php )
[1] => Array ( [_id] => 236 [areaSlug] => merton [region-area-list] => Merton [_title] => Merton [_page] => /careers/homecare/vacancies.php )
[2] => Array ( [_id] => 237 [areaSlug] => wandsworth [region-area-list] => Wandsworth [_title] => Wandsworth [_page] => /careers/homecare/vacancies.php )
[3] => Array ( [_id] => 238 [areaSlug] => sutton [region-area-list] => Sutton [_title] => Sutton [_page] => /careers/homecare/vacancies.php )
[4] => Array ( [_id] => 239 [areaSlug] => southwark [region-area-list] => Southwark [_title] => Southwark [_page] => /careers/homecare/vacancies.php )
[5] => Array ( [_id] => 240 [areaSlug] => ealing [region-area-list] => Ealing [_title] => Ealing [_page] => /careers/homecare/vacancies.php )
[6] => Array ( [_id] => 241 [areaSlug] => brent [region-area-list] => Brent [_title] => Brent [_page] => /careers/homecare/vacancies.php )
[7] => Array ( [_id] => 242 [areaSlug] => croydon [region-area-list] => Croydon [_title] => Croydon [_page] => /careers/homecare/vacancies.php ) )

Simon C.
100% (23)Projects Completed
20
Freelancers worked with
16
Projects awarded
39%
Last project
13 Dec 2024
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies