Skip to content

Instantly share code, notes, and snippets.

@IgorDePaula
Last active November 30, 2023 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IgorDePaula/0c894ad5db9022f4aea4ac29a182a316 to your computer and use it in GitHub Desktop.
Save IgorDePaula/0c894ad5db9022f4aea4ac29a182a316 to your computer and use it in GitHub Desktop.
<?php
$data = [
[
'id'=>2,
'name'=>'asd'
]
];
$strutrura = new stdClass;
$strutura->origin_id = 2;
$newArray = [];
forech($data as $line){
$newArray[$line['id']] = $line;
}
$strutura->nome = $newArray[$strutura->origin_id]['nome'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment