Dynamic variable names in PHP ?

The place for general PHP questions and hints for PHP on IBM i

Dynamic variable names in PHP ?

Postby maha96 on Thu Jun 08, 2017 7:04 pm

I'm trying to use dynamic variable names (I'm not sure what they're actually called) But pretty much like this:

for($i=0; $i<=2; $i++) {
$("file" . $i) = file($filelist[$i]);
}

var_dump($file0);
he return is null which tells me it's not working when i applied to fathers day quotes php web design
maha96
 
Posts: 1
Joined: Thu Jun 08, 2017 7:02 pm

Re: Dynamic variable names in PHP ?

Postby liam9130 on Tue Jun 13, 2017 8:11 am

I was also trying to use this coding but was unable to implement and achieve the result. I am also looking for the answer as i got an assignment to be submitted by next week. I am also looking for the assignment writing service as well because they know how to write these kinds of assignments.
liam9130
 
Posts: 1
Joined: Tue Jun 13, 2017 7:53 am
Location: United Kingdom

Re: Dynamic variable names in PHP ?

Postby judy6640 on Sat Jun 17, 2017 11:30 am

How to dynamically create an object with parameter passing to the constructor?
judy6640
 
Posts: 9
Joined: Sat Jun 17, 2017 10:07 am

Re: Dynamic variable names in PHP ?

Postby sara8275 on Fri Aug 18, 2017 7:55 am

To simply solve this issue, take help from different developers and designers around you. some problems need to sort out by personal research and solutions. Dynamic variables is not a big issue overall, however, it may give you a tuff time if you are missing some ordinary command.
sara8275
 
Posts: 1
Joined: Fri Aug 18, 2017 7:47 am
Location: Dubai

Re: Dynamic variable names in PHP ?

Postby jord5882 on Wed Dec 13, 2017 8:34 am

Thanks for sharing them! I am hoping you will proceed to have similar posts to share with each person.
jord5882
 
Posts: 1
Joined: Wed Dec 13, 2017 8:33 am
Location: United Kingdom

Re: Dynamic variable names in PHP ?

Postby neha550 on Tue Jan 09, 2018 7:48 am

In PHP, you can just use a $ in front of a variable to make it a dynamic variable:

Example:

<?php
$$a = 'world';
?>
neha550
 
Posts: 13
Joined: Tue Jan 09, 2018 6:29 am
Location: Chennai

Re: Dynamic variable names in PHP ?

Postby trap6408 on Tue Jan 09, 2018 1:00 pm

[url]waqeqaewae[/url]
trap6408
 
Posts: 1
Joined: Tue Jan 09, 2018 12:54 pm


Return to PHP Questions / Hints

Who is online

Users browsing this forum: No registered users and 1 guest