Last active
September 7, 2024 11:52
-
-
Save ArchTaqi/527a9f4bb60d2f6bbb2822a6fe6538af to your computer and use it in GitHub Desktop.
QueryBuilder PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Usage example: | |
$calculator = new Calculator(); | |
$result = $calculator->setValue(5)->add(3)->multiply(2)->getResult(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$queryBuilder = new QueryBuilder(); | |
$query = $queryBuilder->select(['id', 'name', 'email']) | |
->from('users') | |
->where('age > 18') | |
->where('status = "active"') | |
->orderBy('name', 'DESC') | |
->limit(10) | |
->getQuery(); | |
echo $query; // Outputs: SELECT id, name, email FROM users WHERE age > 18 AND status = "active" ORDER BY name DESC LIMIT 10 | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment