Created
April 17, 2020 02:54
-
-
Save phpfiddle/17f0689b4a3606c7713d1d4c44959143 to your computer and use it in GitHub Desktop.
[ Posted by Victor Lopez ] Tree sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$n0000 = ['{id:A0}','COGTO - CLASIFICADOR OBJETO DEL GASTO',null,null]; | |
$n0001 = ['{id:A1}','10000 - SERVICIOS PERSONALES', null, null]; | |
$n0011 = ['{id:A11}','11000 - REMUNERACIONES AL PERSONAL DE TRABAJO PERMANENTE',null, null]; | |
$n0111 = ['{id:A111}','11100 - DIETAS', null, null, '{format:{expanded:true}']; | |
$n1111 = ['{id:A1111}', '11101 - DIETAS', 'https://www.google.com', 'mainFrame']; | |
$n1112 = ['{id:A1112}', 'Level 3, Item 2', 'https://www.fast.com', null]; | |
$arrFin = []; | |
for($x=0; $x<=3; $x++){ | |
$n = 'NIVEL'.$x; | |
$comp[]=$n; | |
$comp[]=null; | |
$comp[]=null; | |
//$cap=[]; | |
$ii=-1; | |
for($y=0; $y<=1; $y++){ | |
$m = 'DENTRO'.$y; | |
$ii++; | |
$cap[] = $m; | |
$cap[] = null; | |
$cap[] = null; | |
// $filas = []; | |
// $zz=-1; | |
// for($z=0; $z<=1; $z++){ | |
// $o = 'MAAAS'.$z; | |
// $zz++; | |
// $filas[$zz]=$o; | |
// } | |
// $cap[$ii]=$filas; | |
} | |
$comp[]=$cap; | |
} | |
array_push($arrFin,$comp); | |
print_r($arrFin); | |
print_r('<br><br>'); | |
$fin = json_encode($arrFin); | |
print_r($fin); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment