Home Backend Development PHP Problem Don't think that you don't need to learn C language to do PHP

Don't think that you don't need to learn C language to do PHP

Sep 04, 2019 am 11:43 AM
c language php

Don't think that you don't need to learn C language to do PHP

The reason why I say "Don't think that learning PHP does not require learning C language" is because you only learn PHP without any basic languages ​​​​such as C language. It is difficult to deeply understand many things in PHP without the support.

There are actually many such examples. Here I will give you this example: the difference and connection between PHP arrays and C language arrays.

Friends who have studied C language certainly know that there are arrays in C language;

There are also arrays in PHP, but their functions are almost completely different. PHP has too many arrays and is very easy to use. function. So what's the reason? Are there many kinds of arrays and you just learn one of them? Actually not.

The fundamental reason is: the array in C language is a real array, which is a continuous storage space applied for on the stack. Once this kind of space is applied for, you cannot add an element or delete an element. It can only be operated as a whole, either delete it all, or re-apply for an array. This is a real array.

The array in PHP is actually not such an array. It applies for memory in the heap, then uses a pointer to point to the head address, and then traverses the pointer, so that a certain element can be deleted and a new one can be added at any time. elements, because it is no longer a real array in nature, but a linked list.

So it can be seen from here that C language is of great significance to the understanding and learning of PHP. Without the linked list support of C language, the features of PHP will appear inexplicably, and you will always feel that you have no place to stand despite your fantasies.

The linked list principle in C language is the principle basis for realizing vector, list, map, and other dynamic arrays, linked lists, sets, and queues in C. It is also the principle basis for realizing arrays in PHP (essentially dynamic arrays implemented by linked lists). ) principle basis.

Then the understanding of the complex data structures of the upper-layer language will become logical. The operations on PHP arrays become easy to understand. For example:

Insert an element at the end:

Dont think that you dont need to learn C language to do PHP

Dont think that you dont need to learn C language to do PHP

##Pop up an element:


Dont think that you dont need to learn C language to do PHP

Dont think that you dont need to learn C language to do PHP

#These things are very comfortable to use and will not pop up a scary black window error message for you, but behind the comfort, you need a foundation to support it. It's its business to sacrifice compilation performance, but it's your business to understand it. If you can't understand it, you can only memorize it, which will be uncomfortable because it will be easy to forget.

How to avoid forgetting easily is to understand it, its origin, and the principles of its feasibility.... Only then will everything go naturally. No one stipulates that if you want to learn it, you have to learn it very painfully.

Knowing it but not knowing why is the biggest obstacle to success in learning and the biggest factor in learning bottlenecks.

So the significance of C language is to have an easier understanding of upper-level languages. Upper-level languages ​​such as PHP are not used to learn linked lists, but to use linked lists. So using PHP to write a linked list actually doesn't make much sense.

That's just an "academic show off" for beginners who have little experience. Because even pointers are hidden in PHP, how can we have a deep understanding of linked lists? It’s no wonder that those who learn C look down on those who learn C, and those who learn C look down on those who learn PHP; the difficulty is different. In the eyes of programmers with profound internal skills, many so-called experienced people are actually doing things to "grandstand", I guess. The feeling that it doesn't matter as long as it can fool beginners.

You must be good at associating in order to reduce the burden of learning. Only by paying attention to your learning mood can you achieve long-term results. Being good at understanding still requires a certain amount of strength, breadth and depth to support it.

So, don’t think that learning PHP means you don’t have to learn C language. Otherwise, it will be difficult for you to understand many things in PHP. Without a foundation, you can only rely on fantasy and recitation, and it will be difficult to learn deeply and for a long time. Because it is too tiring... At the same time, learning C language does not mean that you have passed the test after reading and learning it. The key is to know and understand it.

For example, can you explain what a linked list is to a person who doesn't understand computers? What are the characteristics, how to implement it, etc. How much you can say shows how much you know.

If you want to know more related issues, please visit the PHP Chinese website:

PHP Video Tutorial

The above is the detailed content of Don't think that you don't need to learn C language to do PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

C language data structure: data representation and operation of trees and graphs C language data structure: data representation and operation of trees and graphs Apr 04, 2025 am 11:18 AM

C language data structure: The data representation of the tree and graph is a hierarchical data structure consisting of nodes. Each node contains a data element and a pointer to its child nodes. The binary tree is a special type of tree. Each node has at most two child nodes. The data represents structTreeNode{intdata;structTreeNode*left;structTreeNode*right;}; Operation creates a tree traversal tree (predecision, in-order, and later order) search tree insertion node deletes node graph is a collection of data structures, where elements are vertices, and they can be connected together through edges with right or unrighted data representing neighbors.

The truth behind the C language file operation problem The truth behind the C language file operation problem Apr 04, 2025 am 11:24 AM

The truth about file operation problems: file opening failed: insufficient permissions, wrong paths, and file occupied. Data writing failed: the buffer is full, the file is not writable, and the disk space is insufficient. Other FAQs: slow file traversal, incorrect text file encoding, and binary file reading errors.

Explain the match expression (PHP 8 ) and how it differs from switch. Explain the match expression (PHP 8 ) and how it differs from switch. Apr 06, 2025 am 12:03 AM

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

What is Cross-Site Request Forgery (CSRF) and how do you implement CSRF protection in PHP? What is Cross-Site Request Forgery (CSRF) and how do you implement CSRF protection in PHP? Apr 07, 2025 am 12:02 AM

In PHP, you can effectively prevent CSRF attacks by using unpredictable tokens. Specific methods include: 1. Generate and embed CSRF tokens in the form; 2. Verify the validity of the token when processing the request.

C language multithreaded programming: a beginner's guide and troubleshooting C language multithreaded programming: a beginner's guide and troubleshooting Apr 04, 2025 am 10:15 AM

C language multithreading programming guide: Creating threads: Use the pthread_create() function to specify thread ID, properties, and thread functions. Thread synchronization: Prevent data competition through mutexes, semaphores, and conditional variables. Practical case: Use multi-threading to calculate the Fibonacci number, assign tasks to multiple threads and synchronize the results. Troubleshooting: Solve problems such as program crashes, thread stop responses, and performance bottlenecks.

How can you prevent a class from being extended or a method from being overridden in PHP? (final keyword) How can you prevent a class from being extended or a method from being overridden in PHP? (final keyword) Apr 08, 2025 am 12:03 AM

In PHP, the final keyword is used to prevent classes from being inherited and methods being overwritten. 1) When marking the class as final, the class cannot be inherited. 2) When marking the method as final, the method cannot be rewritten by the subclass. Using final keywords ensures the stability and security of your code.

How to output a countdown in C language How to output a countdown in C language Apr 04, 2025 am 08:54 AM

How to output a countdown in C? Answer: Use loop statements. Steps: 1. Define the variable n and store the countdown number to output; 2. Use the while loop to continuously print n until n is less than 1; 3. In the loop body, print out the value of n; 4. At the end of the loop, subtract n by 1 to output the next smaller reciprocal.

See all articles