Coding discussion
Moderator: ItL Moderators
- Maxine MagicFox
- ItL Webmaster
- Posts: 13474
- Joined: Wed Feb 27, 2008 12:20 pm
- Location: Pennsylvania
- Contact:
Re: Coding discussion
I want to learn it, ABSOLUTELY, but I spent a whole hour today trying to figure it out when it's for a few simple lines of code.
Well, I'll take the comparison chart and try again. :\
I had made a little progress but this chart does show me a cleaner way of doing it that I wasn't aware of. :\ Hrrrm...
I do have one question, though, and this probably seems very newbish. What is the actual explanation in simple terms for ->. I've heard "object->property" but I'm not sure I fully understand. :\ We were not introduced to it in our classes.
Well, I'll take the comparison chart and try again. :\
I had made a little progress but this chart does show me a cleaner way of doing it that I wasn't aware of. :\ Hrrrm...
I do have one question, though, and this probably seems very newbish. What is the actual explanation in simple terms for ->. I've heard "object->property" but I'm not sure I fully understand. :\ We were not introduced to it in our classes.
[] - [] - [] - []
- negzee
- ItL's resident princess
- Posts: 4049
- Joined: Sun Aug 31, 2008 6:45 pm
- Location: Minnesoouuda
- Contact:
Re: Coding discussion
"object->property" is the simplest description of the object operator in PHP.
You can sorta (sorta) think of it like the slashes in a URL, if that helps. Objects can have other objects as properties and you'll often see that operator chained like object->object->....
You can sorta (sorta) think of it like the slashes in a URL, if that helps. Objects can have other objects as properties and you'll often see that operator chained like object->object->....
- Maxine MagicFox
- ItL Webmaster
- Posts: 13474
- Joined: Wed Feb 27, 2008 12:20 pm
- Location: Pennsylvania
- Contact:
Re: Coding discussion
[] - [] - [] - []
- Reynard-Miri
- Manticor
- Posts: 3190
- Joined: Tue Jul 10, 2012 5:09 am [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
- Maxine MagicFox
- ItL Webmaster
- Posts: 13474
- Joined: Wed Feb 27, 2008 12:20 pm
- Location: Pennsylvania
- Contact:
Re: Coding discussion
Ironically, Rey... that actually helped. >_>; That triggered a memory of my teacher saying that in class. Got out my old notes and figured it out. Objects are basically a clump of functions and shit like that.
[] - [] - [] - []
- negzee
- ItL's resident princess
- Posts: 4049
- Joined: Sun Aug 31, 2008 6:45 pm
- Location: Minnesoouuda
- Contact:
Re: Coding discussion
The precise definition of an object (in an object-oriented programming, or OOP, context) varies between languages, but the general notion of an object in most languages that have some kind of OO aspect to them is that of a container that bundles some variables and the functions (referred to as methods in PHP when part of an object) that operate on them.
In your snippet, $date is an object that is an instance of the DateTime class. Classes are essentially blueprints for making usable objects with the properties and behaviours described by that class.
$date->format(...) in your snippet is a reference to the format() method defined in the DateTime class.
The official Java tutorials site has a fairly casual and approachable , which applies to PHP as well.
In your snippet, $date is an object that is an instance of the DateTime class. Classes are essentially blueprints for making usable objects with the properties and behaviours described by that class.
$date->format(...) in your snippet is a reference to the format() method defined in the DateTime class.
The official Java tutorials site has a fairly casual and approachable , which applies to PHP as well.
- Maxine MagicFox
- ItL Webmaster
- Posts: 13474
- Joined: Wed Feb 27, 2008 12:20 pm
- Location: Pennsylvania
- Contact:
Re: Coding discussion
[] - [] - [] - []
- negzee
- ItL's resident princess
- Posts: 4049
- Joined: Sun Aug 31, 2008 6:45 pm
- Location: Minnesoouuda
- Contact:
Re: Coding discussion
The problem you're having with the second connection isn't with classes, but functions.
- Maxine MagicFox
- ItL Webmaster
- Posts: 13474
- Joined: Wed Feb 27, 2008 12:20 pm
- Location: Pennsylvania
- Contact:
Re: Coding discussion
O_O Aw! GLOBAL!
^_^ FIXED!
*mutters* <_<; That wasn't very fun... I was so sure there was something more complicated I was doing wrong.
Anywho, though, considering you didn't say anything :3 I'm assuming I'm using the -> stuff correctly and the class is set up correctly (now that $link is set to GLOBAL)?
(BTW, XD I liked the tutorial hint treatment.)
^_^ FIXED!
*mutters* <_<; That wasn't very fun... I was so sure there was something more complicated I was doing wrong.
Anywho, though, considering you didn't say anything :3 I'm assuming I'm using the -> stuff correctly and the class is set up correctly (now that $link is set to GLOBAL)?
(BTW, XD I liked the tutorial hint treatment.)
[] - [] - [] - []
- Maxine MagicFox
- ItL Webmaster
- Posts: 13474
- Joined: Wed Feb 27, 2008 12:20 pm
- Location: Pennsylvania
- Contact:
Re: Coding discussion
^_^ Oh, by the way - in case I haven't said it recently, negzee. THANK YOU SO MUCH FOR THE HELP! I appreciate your teaching me like this. <_<; Sorry for being such a n00b sometimes. And everyone else, too!
[] - [] - [] - []
- Maxine MagicFox
- ItL Webmaster
- Posts: 13474
- Joined: Wed Feb 27, 2008 12:20 pm
- Location: Pennsylvania
- Contact:
Re: Coding discussion
[] - [] - [] - []
- negzee
- ItL's resident princess
- Posts: 4049
- Joined: Sun Aug 31, 2008 6:45 pm
- Location: Minnesoouuda
- Contact:
Re: Coding discussion
There's no mysqli equivalent to mysql_result(). The way you're doing it is perfectly fine, although I wouldn't bother to name the value of count(*), and would simply fetch_array() instead of fetch_assoc().
As for mysqli_result::free() and mysqli::close(), you generally don't try to test if they worked.
As for mysqli_result::free() and mysqli::close(), you generally don't try to test if they worked.
- Maxine MagicFox
- ItL Webmaster
- Posts: 13474
- Joined: Wed Feb 27, 2008 12:20 pm
- Location: Pennsylvania
- Contact:
Re: Coding discussion
[] - [] - [] - []
- Kimiko
- Manticor
- Posts: 6044
- Joined: Wed Jun 18, 2008 9:31 am
- Location: Leiden, Netherlands, EU [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Coding discussion
Could it be that a different ISP has different versions of essential software installed?
Kimiko
Rewatching: Beast Player Erin
Rewatching: Beast Player Erin
Return to “Discussion Section”
Who is online
Users browsing this forum: No registered users and 40 guests