Skip to main content

Featured Post

Top 10 Advance Java Interview questions?

Top 10 Advance Java Interview questions?   What are the differences between abstract classes and interfaces in Java? What is the difference between ArrayList and LinkedList in Java? What is the purpose of the finalize() method in Java? What is polymorphism in Java and how is it achieved? What are the different types of inner classes in Java? What is the difference between static and non-static methods in Java? What are the different types of exceptions in Java and how do they differ? What is the difference between checked and unchecked exceptions in Java? How does Java handle multithreading and synchronization? What are the different types of JDBC drivers in Java and how do they differ?

Using variables:-

 Printing information onto the screen is great, but we don’t always know exactly what information we want to print. While we’re writing our code. For example, if we want to print the visitor’s name, there’s no possible way of knowing that information before they visit. That’s where variables come in variables, are a way to store information in order to reference it later variables can be used to store numbers names or other important data in HP variables must start with a dollar sign followed by a letter or an underscore then an alphanumeric character string. Here’s an example. You see that we have our opening PHP tags, a dollar sign followed by the wordage, and then an equal sign and some value. In this case, 34, and we have our semicolon. Age is a placeholder for the number that we have stored in it. Which is 34 PHP knows age is 34 because of the equal sign,

which means is assigned to or gets, I’ll usually say, gets when referencing variables, we can then use age as if it’s the number 34, printing it or even doing calculations on it, like adding subtracting or multiplying. If we decide later we want to change it, we can do that. Two variables are easier to keep track of you can change the Them on the Fly. And most importantly, like the opening example. Sometimes,
you don’t know, certain information at runtime there are also special variables called constants,
that are defined a little differently. In this case, you would use a function or a keyword called
Define with parentheses around it in the parenthesis. You will have the name of the constant in quotes. And in this case, it’s version then a comma and the You of that constant. Which in this case is 1 Point 1, we can then treat the constant as if it’s a variable without a dollar sign. A
couple of things to note though are that, constants are case sensitive. So if we were to write the version in lowercase here, it would not work. And the important part. The reason that constants are called constants is that they are immutable or can’t be changed at runtime. So if we try to reassign a new value to the version using either the guest’s symbol or the Define function. Again, neither of those will work. Constants are great. If you have some value that you know, you absolutely don’t want to change throughout the run time. In both cases for variables and constants, there are a set of predefined values that we can’t use. These are known as reserved words or predefined variables. So for example we can’t use the word this in a variable assignment. Similarly, we can’t create a constant called PHP
underscore version or some other constants that you see here in the PHP manual. The last important aspect to know about variables right now is that computers are very specific about how different types of data are represented. Words are represented differently than numbers are. And further whole numbers are represented differently than decimal numbers. In programming languages,
you need to tell the computer if you are giving it a word or a number. Luckily, PHP. Handles. For most of this us, we don’t need to declare the kind of data.
Our variables are. Most of the time, PHP will figure out how we want to use it and then do it for
us. This makes PHP a week. A typed language that said there are a few different ways variables can be represented as integers, which are Whole numbers like 0 1 or 45 floats, which are numbers with decimal points. For example, 1.0 or 3.16 characters are single letters, numbers, or symbols,
It’s worth noting a few things about characters. The first is that numbers with and without quotes are handled differently, you can do calculations with the integer one, but not the character one, which is represented by quotes around the number one. It’s also worth noting that capital letters are considered different from lowercase letters. So, a capital, A, and a lowercase,
a are considered different by PHP. This is why you are able to use upper and lowercase letters in your passwords to make them more secure.

The last two variable types. Here are strings which are a collection of characters such as hello or racer 5. And billions can have only one of two values, true or false. Now there is
one more type of variable and that’s called an array of arrays are collections or sets of any of the previously mentioned variable types. And you’ll learn a lot more about those while integers.
Floats and boolean’s can be written without the use of quotes strings and characters must be placed in quotes. So for example, we have a string with the variable name so we have the name get Joe and we have a variable called first underscore letter. So we have first underscore letter gets
Jay. You’ll notice, I used both single quotes and double quotes in the example above and there are nuanced differences between them. But for assignments, like these, we can use the single and double quotes interchangeably. You may also notice that with the first underscore letter,
there are no space spaces are not allowed in variable names. And often multi-word variables will replace spaces with an underscore variable.
Are extremely important. As part of working with PHP, you will use them for storing and retrieving
data and it will make writing complex programs much easier.

Comments

Popular posts from this blog

WHAT ARE NEURAL NETWORKS? | Comingfly

WHAT ARE NEURAL NETWORKS ? Neural Networks the process of machine learning are neural networks. These are brain-inspired networks of interconnected layers of algorithms, called neurons, that feed data into each other, and which can be trained to carry out specific tasks by modifying the importance attributed to input data as it passes between the layers. During training of these neural networks, the weights attached to different inputs will continue to be varied until the output from the neural network is very close to what is desired, at which point the network will have 'learned' how to carry out a particular task. A subset of machine learning is deep learning, where neural networks are expanded into sprawling networks with a huge number of layers that are trained using massive amounts of data. It is these deep neural networks that have fueled the current leap forward in the ability of computers to carry out task like speech recognition and computer vision. T here are vario...

What is Go Language ? | Comingfly

What is Go Language ? What Go Language? :- v    Go is a modern, general purpose language. v    A new ,Open source Programming language. v    Concurrent , Builds fast at scale. v    Go language is very fast. v    Garbage-Collected. v    Lightweight syntax. v    Simple type system. v    Productive. v    Simple. v    Fun History of Go language :- Go language developed by Rob Pike   and Ken Thompson. More than 250 contributors join the project.   Design began late in 2007.   Become open source in 2009.   Version is 1.2.2. Feature of Go language ? v   In the current world, languages don't help enough. v   Computers fast but software construction slow. v   Efficiency. v   Safety. v   Speed. v   Concurrency. v   Scalability. v   Fast development cycle. v   No surprises. v   Multi-core Why Developed a Language ? Google has bi...

What is Java? | Comingfly

What is Java? Developed by Sun Microsystems in the mid-1990s, Java was originally built to be a high-level and object-oriented programming language that looks and feels similar to C++. Along with being extremely popular, Java can implement a wide variety of algorithms, which are very useful to the machine learning community. Java is regarded as one of the most secure programming languages, largely due to its use of bytecode and sandboxes. Java manages to harness much of the power of C++ while overcoming its security issues and overall complexity. But with all of its improvements over C++, Java has a reputation for being slower than many other programming languages. Additionally, as of 2019, Java has implemented commercial licensing for certain business applications, which can be costly.