Bagaimana Cara mengkondisionalkan item di dalam TO::JSON([...]) ? Apakah memungkinkan? #232
Answered
by
taufik-nurrohman
yuliakbard
asked this question in
Q&A
-
Kang cara penulisan kondisonal di dalam
ane mau bikin kondisional pada ListItem ke 2 aja, bisa dikondisionalkan gak ya kang? apa harus dari sini mengkondisionalkan baris kode nya |
Beta Was this translation helpful? Give feedback.
Answered by
taufik-nurrohman
Aug 19, 2022
Replies: 1 comment 1 reply
-
Begini caranya mas: $data = [];
$data[0] = ['a' => 'b'];
if ($site->is('page')) {
$data[1] = ['c' => 'd'];
}
$data[2] = ['e' => 'f'];
$content = '<script>';
$content .= To::JSON($data);
$content .= '</script>'; |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
yuliakbard
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Begini caranya mas: