Results 1 to 10 of 34
-
29th Apr 2010, 06:19 PM #1OPMemberWebsite's:
maxneeds.infoHow would you translate this in PHP ?
For first value in $var do something...
I think it is subarray.. like - $entry_array[ 'entry' ] .. So t3od0r how to choose the first or any other value.. And btw the values are actually all entries/pages of content.
I think if($entry_array[ 'entry' ][0]) works but if i want to do this ---
if($entry_array[ 'entry' ][0]){$entry_array[ 'entry' ][0]=$entry_array[ 'entry' ][0].'TEST';}
it adds 'TEST' to all entries not the first one...(maybe because the code like this means 'if exist'?)Porsche_maniak Reviewed by Porsche_maniak on . How would you translate this in PHP ? For first value in $var do something... I think it is subarray.. like - $entry_array .. So t3od0r how to choose the first or any other value.. And btw the values are actually all entries/pages of content. I think if($entry_array) works but if i want to do this --- if($entry_array){$entry_array=$entry_array.'TEST';} it adds 'TEST' to all entries not the first one...(maybe because the code like this means 'if exist'?) Rating: 5
-
29th Apr 2010, 06:45 PM #2
-
29th Apr 2010, 06:45 PM #3MemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comfirst value in $var?
then $var is an array right? $var = array("1","2","3");
first value : $var[0] -> will show 1
-
29th Apr 2010, 06:47 PM #4MemberWebsite's:
btjunk.netI think he want to do something with firs array value, not sure about that.
-
29th Apr 2010, 07:36 PM #5OPMemberWebsite's:
maxneeds.infoI think it is subarray.. like - $entry_array[ 'entry' ] .. So t3od0r how choose the first or any other value.. And btw the values are actually all entries/pages of content.
I think if($entry_array[ 'entry' ][0]) works but if i want to do this ---
if($entry_array[ 'entry' ][0]){$entry_array[ 'entry' ][0]=$entry_array[ 'entry' ][0].'TEST';}
it adds 'TEST' to all entries not the first one...(maybe because the code like this means 'if exist'?)
-
29th Apr 2010, 07:50 PM #6Member
Depends on the keys used for the elements in the array. Keys, by default, are incrementing integers.
PHP Code:// Incremental integer keys assigned by PHP
$fruits = array( 'Apple', 'Orange', 'Banana' );
echo $fruits[0];
// Output: Apple
echo $fruits[1];
// Output: Orange
PHP Code:// Explicitly assigned keys
$fruitColors = array(
'Apples' => 'red',
'Oranges' => 'orange',
'Bananas' => 'yellow'
);
echo $fruitColors[ 'Apple' ];
// Output: red
foreach( $fruitColors as $fruit => $color )
{
echo $fruit . ' are <span style="color:' . $color . ';">' . $color . '</span>.<br />' . "\n";
}
Apples are red.
Oranges are orange.
Bananas are yellow.
-
29th Apr 2010, 07:54 PM #7MemberWebsite's:
litewarez.net litewarez.com triniwarez.comPHP Code:$result = (isset($var[0]) ? $var[0] : null);
PHP Code:for($i=0;$<=count($var);$i++)
{
switch($i)
{
case 0:
//First item here
$var[$i] = strtolower($var[$i]);
break;
default:
//All other elements in the array
$var[$i] = strtoupper($var[$i])
break;
}
}
Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
29th Apr 2010, 07:56 PM #8MemberWebsite's:
epicimagehost.comIsn't he talking about multidimensional arrays?
-
29th Apr 2010, 08:00 PM #9Member
Then we have multidimensional arrays.
PHP Code:// Two-dimensional array
$produce = array(
'fruits' => array( 'Apples', 'Oranges', 'Bananas' ),
'vegs' => array( 'Tomatos', 'Potatos', 'Carrots' )
);
echo $produce[ 'fruits' ][0];
// Output: Apples
echo $produce[ 'vegs' ][2];
// Output: Carrots
-
29th Apr 2010, 08:02 PM #10MemberWebsite's:
litewarez.net litewarez.com triniwarez.comMultidimensional arrays still have an index of numerics as well as strings so example
PHP Code:$user = array(
'dob' => 25121988,
'age' => 21,
'profile' => array(
'username' => 'litewarez'
)
);
$profile_1 = $user['profile']; //array(username ...)
$profile_2 = $user[2]; //array(username ...)
//the same
PHP Code:print_r($entry_array);
Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Translate page
By skinner in forum Web Development AreaReplies: 1Last Post: 1st May 2012, 01:35 PM -
How to translate a template ?
By Debaldus in forum DLEReplies: 9Last Post: 20th Feb 2012, 07:58 PM -
need translate script
By peterpetroli in forum Web Development AreaReplies: 5Last Post: 29th Dec 2011, 03:39 AM -
DLE translate tuto
By milooot in forum Webmaster DiscussionReplies: 3Last Post: 3rd Aug 2011, 05:23 PM -
Can someone translate this for me
By kohkindachi in forum Technical Help Desk SupportReplies: 2Last Post: 3rd Oct 2010, 01:34 PM
themaCreator - create posts from...
Version 3.24 released. Open older version (or...