You could use array_map()
to do it.
$tags = array_map(function($tag) {
return array(
'name' => $tag['name'],
'value' => $tag['url']
);
}, $tags);
More Related Contents:
- i need a PHP code to find longest contiguous sequence of characters in the string
- storing user_id in session variable
- GCM with PHP (Google Cloud Messaging)
- New self vs. new static
- Passing an array to a query using a WHERE clause
- Seo Friendly URL results in CSS IMG and JS not working
- How to prevent form resubmission when page is refreshed (F5 / CTRL+R)
- PHP Array to JSON Array using json_encode(); [duplicate]
- PHP include relative path
- pdo – Call to a member function prepare() on a non-object [duplicate]
- Accessing dates in PHP beyond 2038
- PHP returning JSON to JQUERY AJAX CALL
- How to make dot match newline characters using regular expressions
- PHP/MySQL Insert null values
- How to disable output buffering in PHP
- PHP – Upload utf-8 filename
- Magic quotes in PHP
- PDO Connection Test
- Resize/crop/pad a picture to a fixed size
- Handle fatal errors in PHP using register_shutdown_function()
- PHP recursive directory path
- Using PHP to get DOM Element
- relative path in require_once doesn’t work
- How to set an Arrays internal pointer to a specific position? PHP/XML
- Catching exceptions from Guzzle
- PHP: variable not working inside of function?
- Laravel – How to get current user in AppServiceProvider
- Is it possible to visualize a bunch of functions in UML
- What Does Using A Single Pipe ‘|’ In A Function Argument Do?
- How to call a Python Script from PHP?