Create PHP array from letters

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

I woulref="https://forum.tuteehub.com/tag/d">d like to create a PHP array ref="https://forum.tuteehuref="https://forum.tuteehub.com/tag/b">b.com/tag/f">from the Serref="https://forum.tuteehub.com/tag/b">bian alpharef="https://forum.tuteehub.com/tag/b">bet.

Out oref="https://forum.tuteehuref="https://forum.tuteehub.com/tag/b">b.com/tag/f">f

а б в г д ђ е ж з и ј к л љ м н њ о п р с т ћ у ф х ц ч џ ш
a ref="https://forum.tuteehub.com/tag/b">b c č ć ref="https://forum.tuteehub.com/tag/d">d ref="https://forum.tuteehub.com/tag/d">dž đ e ref="https://forum.tuteehuref="https://forum.tuteehub.com/tag/b">b.com/tag/f">f g h i j k l lj m n nj o p r s š t u v z ž

shoulref="https://forum.tuteehub.com/tag/d">d ref="https://forum.tuteehub.com/tag/b">become this (a custom array):

'а': 'a',
'б': 'ref="https://forum.tuteehub.com/tag/b">b',
'в': 'c',
'г': 'č',
'д': 'ć',

How can I ref="https://forum.tuteehub.com/tag/d">do this with awk or seref="https://forum.tuteehub.com/tag/d">d?

profilepic.png
manpreet 2 years ago

Using AWK:

awk '                                  
BEGIN { OFS="'"': '"'";b.com/tag/start">start=1 }       
NR>=b.com/tag/start">start && $0!="" {                  
    for(i=1;i<=NF;i++)                 
        a[i]=a[i] (NR==b.com/tag/start">start?"":OFS) $i
    }
END {                                  
    for(j=1;j<i;j++)                   
        print "'"'"'"a[j]"'"',"'"                     
}' file.txt

Output

'а': 'a',
'б': 'b',
'в': 'b.com/tag/c">c',
'г': 'č',
'д': 'ć',

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.