Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I come from Java/Netbeans, and I can indent my Java code using alt+shift+f, I have searched through this site and other articles, but I didn't find a good way to indent PHP.
What I found:
using pear PHP_beautifier
but I have to output the result to a different file or simply copy on terminal result.
using PHP beautifier on the web
I have tried using M-x indent-region in PHP-mode but nothing changes. I tried in jdee for Java code M-x indent-region also doesn't work.
I found other solutions but for JSON, com.lang, Asytle (C/C++/C#)
this is my .emacs
https://gist.github.com/azzamsa/1f76b8ca00fd2737ae08a5c3f6dc6b3f
I am using :
php-mode-1.18.2(ejmr/php-mode), GNU Emacs 24.4.1
and installed php-mode from elpa repo.
After following phils suggestion to use Tab, it works. But when I try to break the code format, and try to see the result using C-x+ h and Tab, it doesn't indent the code properly as what online formater does. e.g.:
public function __construct($name) { $this->name = $name; //$this->numLeg = $numLeg; } public function bark() { return "Woof!"; } public function greet() { return "hello i am " . "$this->name"; } }
There is no result even when I use indent-region. I also tried to use fill-region, and other choice of fill, but no luck. But the online formatter can handle this nicely, the result from online formatter and the expected one is:
indent-region
class Dog { public $numLegs = 4; public $name; public function __construct($name) { $this->name = $name; //$this->numLeg = $numLeg; } public function bark() { return "Woof!"; } public function greet() { return "hello i am " . "$this->name"; } } $dog1 = new Dog("Barker"); $dog2 = new DOg("Amigo");
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.