473,473 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

need help with mysterious array initialization

35 New Member
Hello,

sorry for the cryptic thread subject :)

I'm examining some code at the moment and have come across the following:
Expand|Select|Wrap|Line Numbers
  1. $genders = array(
  2.      'F' => __('Female', true),
  3.      'M' => __('Male', true),
  4. ); 
Normally, if I were to init an array I would simply do:
Expand|Select|Wrap|Line Numbers
  1. $genders = array(
  2.      'F' => 'Female',
  3.      'M' => 'Male'
  4. ); 
So what's with the "__" and the boolean after the strings? This is part of a CakePHP app, if that is of importance.

Thanks in advance!
Dec 8 '09 #1

✓ answered by Atli

Hey.

I believe this is CakePHP's localization function.
See 4.8.1 Internationalizing Your Application in the CakePHP manual.

5 1353
Atli
5,058 Recognized Expert Expert
Hey.

I believe this is CakePHP's localization function.
See 4.8.1 Internationalizing Your Application in the CakePHP manual.
Dec 8 '09 #2
Dheeraj Joshi
1,123 Recognized Expert Top Contributor
1. $genders = array(
2. 'F' => 'Female',
3. 'M' => 'Male'
4. );
Key must be within double quotes right.?

"F" => 'Female';
"M" => 'Male';

Regards
Dheeraj Joshi
Dec 8 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
Key must be within double quotes right.?
no.

: )
Dec 8 '09 #4
Dheeraj Joshi
1,123 Recognized Expert Top Contributor
Yup... As soon as i posted it, i looked into php.net.......

I should have looked it before... :)

Regards
Dheeraj Joshi
Dec 8 '09 #5
brixton
35 New Member
Thanks Atli, just needed that nudge in the right direction :)
Very nice documentation, overall.
Dec 8 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: Henry | last post by:
I finally thought I had an understanding of multi dimensional arrays in C when I get this: #include <stdio.h> #define max_x 3 #define max_y 5 int array;
4
by: Aniruddha | last post by:
I want to initialize an array of function pointers (global) If I do it like: /* definition of foo_1, foo_2, foo_3 all return void and take no args */ void (* foo) (); foo = foo_1 ; foo = foo_2...
9
by: Dadi | last post by:
Hi, I can make a simple initialization work like this: Object ONE_ROW = {{"Vodafone", "5550160100197016"}}; But, now I want to create another array that consists of multiple copies of...
3
by: kk_oop | last post by:
Hi. I recently wrote a simple little template that defines an array that checks attempts to use out of bounds indexes. The only problem is that it does provide the use array style value...
14
by: Glen Dayton | last post by:
While looking at some old code I ran across a snippet that increments a pointer to access different members of a structure: .... struct Badness { std::string m_begin; std::string m_param1;...
15
by: jamx | last post by:
How can you initialize an array, in the initialization list of a constructor ?? SomeClass { public: SomeClass() : *init here* { } private: int some_array; };
7
by: sdlt85 | last post by:
This is part of my program but for some reason it is not taken the value of c in the array P. Can some one help me please. int main() { int x, c, p; cout<<"Enter the value for x: "; cin>>x;...
24
by: DomoChan | last post by:
the code below will compile in visual c++ 2003, but im not sure its valid. unsigned char myString = ""; after this line executes, all the bytes within myString are indeed set to '0's' but is...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.